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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-06-24 : 01:19:31
|
| Paul writes "I need to display a certain record first in a list of about 300 records. I basically need to take record say 212 and show that record first in a dropdown box (almost like a default) then show the rest of the records after that???" |
|
|
olily
Starting Member
37 Posts |
Posted - 2002-06-24 : 04:38:15
|
| You can use SELECT TOP 200 FROM TABLE1 if I get your right. |
 |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2002-06-24 : 06:01:03
|
| I don't think 'olily' is on the right track.....(that'll only give you a random set of 200 records (and no more) from table1...in no particular order)you have first to answer some questions fo yourself.a) is the default record identifiable in any particular way?b) will the default change for different users or over time?c) do you care about the order of the remaining records?d) what if the default record was #211 or 213....would it be the default then or would whatever was in position 212 take over?1 thing you have to do, is to forget about going by record number....because SQL data has no inherent sequencing...unless you EXPLICITY order it.i.e...If i do SQL * FROM TABLE1...100 times in a row....I might get the records coming out 1,2,3,4,5,6,7 etc....but on the 101st execution....the order just MIGHT be different..ie 1,2,3,4,7,6,5,etc...because something has happened to the data outside the control of my SELECT statement.you could break the problem down into 2 parts....locate the default and then locate all other records (except the default).post some DDL, sample input data and sample expected results....and then you'll get a better response from this community. |
 |
|
|
MakeYourDaddyProud
184 Posts |
Posted - 2002-06-24 : 06:42:02
|
| I agree with Andrew. You firstly need to establish what makes your 'special' record different from the rest. Is it by primary key or some data condition?We guys need more information about your data. Post us some DDL and im sure we could provide a solution for your sir.I would guess that the result set would probably be a UNION statement; 1 part covering your expected row and the other for the rest of the data (negated query)Danwww.danielsmall.com IT Factoring |
 |
|
|
|
|
|
|
|