Results 1 to 3 of 3

Thread: Query question

  1. #1
    Join Date
    Oct 2004
    Location
    Dublin, Ireland
    Posts
    16

    Unanswered: Query question

    1. How do I run a query selecting the first 1000 records?
    2. How do I use the 1000 PK values of these records in a different query?

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    how do you determine sequence? i.e. by which field?

    1. select top 1000 pkey from yourtable order by foo

    2. select bar from yourothertable
    where foo in (select top 1000 pkey from yourtable order by foo)
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Oct 2004
    Location
    Dublin, Ireland
    Posts
    16
    That answers my question.

    You're the tops!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •