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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 select only one row from a table

Author  Topic 

BCJ
Starting Member

42 Posts

Posted - 2008-06-18 : 12:27:33
Hi,
how to restrict the query to select only one row .....thanks.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-18 : 12:47:47
SELECT TOP 1 fields FROM Table WHERE conditions ORDER BY field
Go to Top of Page

BCJ
Starting Member

42 Posts

Posted - 2008-06-18 : 12:49:12
Thanks a lot
Go to Top of Page

raky
Aged Yak Warrior

767 Posts

Posted - 2008-06-18 : 12:49:52
duplicate post

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=105088
Go to Top of Page

jkarthik86
Starting Member

1 Post

Posted - 2008-06-18 : 12:59:18
quote:
Originally posted by visakh16

SELECT TOP 1 fields FROM Table WHERE conditions ORDER BY field


We can go for top 1 Query
that is
Select top 1 from Tablename where Condition
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-18 : 13:00:53
quote:
Originally posted by jkarthik86

quote:
Originally posted by visakh16

SELECT TOP 1 fields FROM Table WHERE conditions ORDER BY field


We can go for top 1 Query
that is
Select top 1 fields/* from Tablename where Condition


should specify the reqd fields or * too
Go to Top of Page
   

- Advertisement -