Help with SQL Syntax

C

CJ

Hi!

Regarding this statement:

sSQL = "SELECT * FROM ScheduleDetails WHERE fkScheduleID =
1"

fkScheduleID is a lookup field, its SQL is: SELECT
[Schedule].[ScheduleID], [Schedule].[fkRidesID],
[Schedule].[ScheduleDay] FROM Schedule;

What is the proper syntax that will only get the records
from ScheduleDetails WHERE the [Schedule].[fkRidesID]
value of fkScheduleID is equal to 1

Thank you in advance for you help!!!
 
M

MGFoster

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Not sure what you mean by lookup field. I believe you mean the table
column is formatted to show the ScheduleDay in the table. Is this
correct?

Anyway... I believe this query might suit your purposes:

sSQL = "SELECT SD.* " & _
"FROM ScheduleDetails As SD INNER JOIN Schedule AS S " & _
" ON SD.ScheduleID = S.ScheduleID " & _
"WHERE S.fkRidesID = 1"

You have to join the 2 tables by the ScheduleID (the column that relates
the data in Schedule to data in ScheduleDetails).

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQJFqQ4echKqOuFEgEQKcLwCgrLX1hkvLEgqQHfsWSMCsu2kCPVMAoOnb
vUkJDCBmNyA12b00sW0NltdA
=frUW
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top