Results 1 to 7 of 7

Thread: SQL statement help

  1. #1
    Guest

    Talking

    Let's say I have this in an access recordset (DAO 3.51):

    Code:
    'ID  Name       Last Name
    '
    '0   Robert     Point
    '1   Mark       Stuff
    '1   Dicky      Other stuff
    '2   Freako     Yaddayadda
    '2   Gulp       Packa
    '2   Spoofy     Blahblah
    '3   Frank      Click
    '4   Shrink     Doubleclick
    And let's say I want to pull out all the names with '2' as ID. What's the SQL statement to do that?

  2. #2
    Fanatic Member Stevie's Avatar
    Join Date
    Mar 2000
    Location
    London, UK
    Posts
    565
    SELECT Name, LastName
    FROM TableName
    WHERE ID = '2'
    VB6 sp5, SQL Server 2000, C#

    There are no stupid questions. Only stupid people.

  3. #3
    Guest
    And what if the table name has spaces in it?
    Shoud I use:

    SELECT Name, LastName FROM "Table Name" WHERE ID = 2

    ?

  4. #4
    Fanatic Member Stevie's Avatar
    Join Date
    Mar 2000
    Location
    London, UK
    Posts
    565
    SELECT Name, LastName
    FROM [Table Name]
    WHERE ID = '2'
    VB6 sp5, SQL Server 2000, C#

    There are no stupid questions. Only stupid people.

  5. #5
    Guest
    Thanks a lot

  6. #6
    Guest
    Problem
    It only returns the first record with the specified ID.
    What's wrong?

  7. #7
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    If you're using a recordset, you'll need to read (movenext) the next record in it...

Posting Permissions

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



Click Here to Expand Forum to Full Width