T
Terry
I am attempting to write a sql select statement. The competitor table has
two fields which link to data in two other tables. Fields in the rider
table and fields in the bracket table. First I tried joining one table as
in the following:
SELECT c.cmp_age, c.cmp_brt_id, c.cmp_evt_id, c.cmp_brt_id,
c.cmp_elapsedtime, c.cmp_rdr_id, r.rdr_firstname, r.rdr_id, r.rdr_lastname,
r.rdr_sex
FROM competitor c
INNER JOIN rider r ON (c.cmp_rdr_id = r.rdr_id)
where cmp_evt_id = :eventid
order by cmp_brt_id, cmp_elapsedtime
and this worked fine.
When I added the second table I got errors
SELECT c.cmp_age, c.cmp_brt_id, c.cmp_evt_id, c.cmp_brt_id,
c.cmp_elapsedtime, c.cmp_rdr_id, r.rdr_firstname, r.rdr_id, r.rdr_lastname,
r.rdr_sex, b.brt_id, b.brt_type, b.brt_division
FROM competitor c
INNER JOIN rider r ON (c.cmp_rdr_id = r.rdr_id)
INNER JOIN bracket b ON (c.cmp_brt_id = b.brt_id)
where cmp_evt_id = :eventid and r.rdr_sex = 'M'
order by cmp_brt_id, cmp_elapsedtime
error was - Syntax error (missing operator) in query expression '(cmp_rdr_id
= r.rdr_id) INNER JOIN bracket b ON (c.cmp_brt_id = b.brt_id)'
Any suggestions on how to get this to work?
Thanks
two fields which link to data in two other tables. Fields in the rider
table and fields in the bracket table. First I tried joining one table as
in the following:
SELECT c.cmp_age, c.cmp_brt_id, c.cmp_evt_id, c.cmp_brt_id,
c.cmp_elapsedtime, c.cmp_rdr_id, r.rdr_firstname, r.rdr_id, r.rdr_lastname,
r.rdr_sex
FROM competitor c
INNER JOIN rider r ON (c.cmp_rdr_id = r.rdr_id)
where cmp_evt_id = :eventid
order by cmp_brt_id, cmp_elapsedtime
and this worked fine.
When I added the second table I got errors
SELECT c.cmp_age, c.cmp_brt_id, c.cmp_evt_id, c.cmp_brt_id,
c.cmp_elapsedtime, c.cmp_rdr_id, r.rdr_firstname, r.rdr_id, r.rdr_lastname,
r.rdr_sex, b.brt_id, b.brt_type, b.brt_division
FROM competitor c
INNER JOIN rider r ON (c.cmp_rdr_id = r.rdr_id)
INNER JOIN bracket b ON (c.cmp_brt_id = b.brt_id)
where cmp_evt_id = :eventid and r.rdr_sex = 'M'
order by cmp_brt_id, cmp_elapsedtime
error was - Syntax error (missing operator) in query expression '(cmp_rdr_id
= r.rdr_id) INNER JOIN bracket b ON (c.cmp_brt_id = b.brt_id)'
Any suggestions on how to get this to work?
Thanks