Newbie select question (Just select first record)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Cyprus106
    New Member
    • Apr 2008
    • 31

    Newbie select question (Just select first record)

    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!
  • siva538
    New Member
    • Jun 2007
    • 44

    #2
    Originally posted by Cyprus106
    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

    Comment

    Working...