Computing.Net > Forums > Database > select only one row

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

select only one row

Reply to Message Icon

Name: eye-designs
Date: May 8, 2007 at 04:44:59 Pacific
OS: Win Vista Biz
CPU/Ram: Pentium M
Comment:

hello,
i've got a select query which returns a couple of rows.
now i would like for the query to return only one row (the first match it can find).
how do i do that?
thank you!



Sponsored Link
Ads by Google

Response Number 1
Name: sboffin
Date: May 8, 2007 at 11:13:51 Pacific
Reply:

try

SELECT
TOP 1
*
FROM TABLE



0

Response Number 2
Name: Don Arnett
Date: May 15, 2007 at 09:26:07 Pacific
Reply:

I've also seen the keyword "limit" used. The particular keyword and syntax will be particular to your database.



0

Response Number 3
Name: kevin freak
Date: August 3, 2007 at 06:00:33 Pacific
Reply:

Hi,
You can limit the number of rows in the output of a query by using the rowcount parameter as

sql > select * from emp where rowcount < 2;
hope it will help u :-)


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Database Forum Home


Sponsored links

Ads by Google


Results for: select only one row

SQL compact multiple row update www.computing.net/answers/dbase/sql-compact-multiple-row-update/189.html

Dynamic select Scripts / Pivot www.computing.net/answers/dbase/dynamic-select-scripts-pivot/410.html

Automatically Sort Excel Worksheet www.computing.net/answers/dbase/automatically-sort-excel-worksheet/525.html