Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
ssmani84
Starting Member
20 Posts |
Posted - 2010-07-05 : 01:22:54
|
hi friends, I want to retrieve particular no of records from table with Condition..my table structure isQID Question Status 1 ssssss True 2 ssssss True 3 ssssss False 4 ssssss False 5 ssssss Falsehere i want to 3 questions condition is Status Filed TRUE Questions are must be getting..how can i get 3 questions from this table Pls Help memy query is belowselect top (3) QuestionID,Question from Question where Status='True'but this query return only 2 valuesssmaniyadav |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-07-05 : 01:45:07
|
you have only 2 rows in the table with Status = 'True'What do you want the 3rd record be like ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
ssmani84
Starting Member
20 Posts |
Posted - 2010-07-05 : 01:56:56
|
I want to 3 rows from this table ..i dont know the exact query..i need to return 2 rows in the table with Status = 'True' and 1 row in the table with Status = 'False'ssmaniyadav |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-07-05 : 02:06:00
|
[code]select top (3) QuestionID,Question from Questionwhere Status='True'order by Status desc[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
ssmani84
Starting Member
20 Posts |
Posted - 2010-07-05 : 02:34:03
|
Thanks Khtan...its working finessmaniyadav |
 |
|
|
|
|