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

Newbie select question (Just select first record)

P: 31
So I've got about a million records that I'm sifting through with a SELECT statement. Right now I've been saying SELECT * FROM MYTABLE WHERE MYFIELD='GUIDE'...

But I only want the first record it finds that matches the criteria. I thoguht it was SELECT FIRST but I was wrong. I know this is awfulyl simple, but I can't find tha answer!!

Any help is much appreciated! Thanks!
Apr 15 '08 #1
Share this Question
Share on Google+
1 Reply


P: 44
So I've got about a million records that I'm sifting through with a SELECT statement. Right now I've been saying SELECT * FROM MYTABLE WHERE MYFIELD='GUIDE'...

But I only want the first record it finds that matches the criteria. I thoguht it was SELECT FIRST but I was wrong. I know this is awfulyl simple, but I can't find tha answer!!

Any help is much appreciated! Thanks!

I guess you are looking for TOP clause ....

you can write as

SELECT TOP 1 * FROM MYTABLE WHERE MYFIELD = 'GUIDE'

if you are creating a view on top of this .. you have to use order by clause along with this select
Apr 15 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.