sql question



using ado and microsoft access

the following join works
select o.otrq_emp_clocknum, o.otrq_date, o.otrq_period,
e.emp_clocknum, e.emp_lastname + ', ' + e.emp_firstname as fullname
from otrequests o
inner join employee e on o.otrq_emp_clocknum = e.emp_clocknum


the otrq_period is an id field from a lookup table
otp_id, otp_description from otperiodsLkup

otrq_period = otp_id

I want to get the otp_description to display its text value

i tried

select o.otrq_emp_clocknum, o.otrq_date, o.otrq_period,
e.emp_clocknum, e.emp_lastname + ', ' + e.emp_firstname as fullname
from otrequests o, otperiodsLkup p
inner join employee e on o.otrq_emp_clocknum = e.emp_clocknum
where p.otp_id = o.otrq_period

this gives a syntax error in join

how do I get the lookup value into the select?

thank you for any help

.



Relevant Pages

  • sql join and lookup table question
    ... using ado and microsoft access ... the otrq_period is an id field from a lookup table ... otp_id, otp_description from otperiodsLkup ... from otrequests o, otperiodsLkup p ...
    (borland.public.delphi.database.ado)
  • Re: sql join and lookup table question
    ... from otrequests o, otperiodsLkup p ... this gives a syntax error in join ... how do I get the lookup value into the select? ... from otrequests o Inner Join otperiodsLkup p on p.otp_id = o.otrq_period ...
    (borland.public.delphi.database.ado)
  • Re: sql question
    ... from otrequests o, otperiodsLkup p ... You are inner joining employee to outrequests, not to otperiodsLkup, so ...
    (borland.public.delphi.database.ado)