Tell me, please, how in SQL you can display a column that includes a specified number of lines with its text (the text must be static). Let me explain, it is necessary that to the left of the column (see screenshot) there appears another column in which there were 4 lines with explanations for each digit:

alt text

Thanks in advance!

UPD: You need something like the one on the screenshot below, only the text in each line is different. Here I just output it via (SELECT 'One'), but this way it’s impossible to output more than 1 different text, i.e. (SELECT ('One', 'Two', 'Three', 'Four')) does not work

alt text

UPD 2: Here, what should happen on the output - painted in paint. The problem is that the first column needs to be done in SQL. Text One, Two, Three, Four must be in the query itself.

alt text

    3 answers 3

    First, explain humanly how your table is arranged, preferably in the form of SQL. Secondly, explain what you ultimately want to achieve, so that two rows would be selected from this table, it is simple:

    SELECT column1, clomun2 FROM table LIMIT n; 

    If you want your values ​​to be selected from different tables, this is also not difficult:

     SELECT table1.column, table2.column1 FROM table1, table2 

    And finally, if you want to just add a few words to the conclusion, why I do not know why sculpt SQL here.

    • The problem is that this text from the first column of the second screenshot is not in the database. This text should be in the request itself - Jembo_by
    • Here, what should happen at the exit - painted in paint. The problem is that the first column needs to be done in SQL img707.imageshack.us/img707/4551/kzsn.png - Jembo_by
    • Why so pervert over SQL, create a table or column and do not complicate your life. - Ukeo
    • I do not have permission to write to the database. And it is necessary to display the text by request, since then this request in the stored procedure will be picked up by another program and output. Therefore, it is necessary to pervert - Jembo_by
     select ... , 'какой-то свой статический текст' from ... 

    upd. depends on the version of a SQL Server in 2000 I would not manage with 1. (I would use an intermediate variable of type table with autoincrement, insert the data there in the right order, then output it) ... in 2005, probably so

    • @ AlexG212 See the second screenshot and explanation of it - Jembo_by
    • Well, how to get the numbers seems clear .. 1,2,3,4. it’s not a problem to make a text out of numbers: either write a function or case - AlexG212

    What the text depends on, then you process, for example:

     select case количество when 298 then 'Один' end Пояснение,количество from таблица 
    • But the number from the second column can vary, it can not be tied to it :) It would be better to bind the word to the line number, but something did not work out for me. - Jembo_by
    • This is an example. What else should I have become attached to, if you showed nothing more than one column? Want to line number - no problem, but then you need to specify how these lines are sorted. You can see that is not in your column. So again the passage. - msi