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 - 2005-09-21 : 07:25:36
|
| Rajdeep writes "Dear SQL Team,Table A SDDOCO* SDDCTO* SDKCOO* SDLNID* SDNXTR2478 SO 00001 1.000 999 2478 SO 00001 2.000 9992478 SO 00001 3.000 9992478 SO 00200 4.000 5402478 SO 00200 5.000 560Pl. refer to the table above, the table has a composite primary index with 4 keys SDDOCO,SDDCTO, SDLNID, SDKCOO. We want to select only those records which have SDNXTR = '999'. So in the above table only the first 3 records should be chosen and not the later 3. Pl. suggest how to do that.Thanks,Rajdeep" |
|
|
homebrew
Posting Yak Master
114 Posts |
Posted - 2005-09-21 : 16:17:05
|
| select * from TableA where SDNXTR = '999' |
 |
|
|
rheitzman
Starting Member
16 Posts |
Posted - 2005-09-21 : 19:45:39
|
| You can always do a Where SDNXTR = '999' but of course it wouldn't use the PK.You would have to add a key on SDNXTR if to need to avoid a full table scan unless you have some other Where clause items to limit the search.Did I misunderstand the question? |
 |
|
|
|
|
|