By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,705 Members | 1,829 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,705 IT Pros & Developers. It's quick & easy.

SQL select

P: n/a
Does SQL select sql = "select * from table 1 where field1=xxx " just
select a row that matched the criteria or select every record in the
table with that criteria ? Pls advise. Thanks

Regards,
Daniel
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
It selects every row where field1=xxx.

If you just want the first one then you need to apply a sort sequence to
the query and then use the Top N option.

Such as :

SELECT TOP 1 OrderID, UnitPrice, ProductID
FROM [Order Details]
WHERE ProductID=11
ORDER BY OrderID DESC;

Regards

Peter Russell

Daniel Tan previously wrote:
Does SQL select sql = "select * from table 1 where field1=xxx " just
select a row that matched the criteria or select every record in the
table with that criteria ? Pls advise. Thanks

Regards,
Daniel


Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.