PDA

Click to See Complete Forum and Search --> : SQL statement help


Aug 30th, 2000, 04:51 AM
Let's say I have this in an access recordset (DAO 3.51):


'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?

Stevie
Aug 30th, 2000, 05:19 AM
SELECT Name, LastName
FROM TableName
WHERE ID = '2'

Aug 30th, 2000, 05:33 AM
And what if the table name has spaces in it?
Shoud I use:

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

?

Stevie
Aug 30th, 2000, 05:42 AM
SELECT Name, LastName
FROM [Table Name]
WHERE ID = '2'

Aug 30th, 2000, 05:51 AM
:) Thanks a lot :D

Aug 30th, 2000, 06:51 AM
Problem :(
It only returns the first record with the specified ID.
What's wrong? :(

JHausmann
Aug 30th, 2000, 10:27 AM
If you're using a recordset, you'll need to read (movenext) the next record in it...