Re: sql join and lookup table question




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

try

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 otperiodsLkup p on p.otp_id = o.otrq_period
inner join employee e on o.otrq_emp_clocknum = e.emp_clocknum


--
Brian Bushay (TeamB)
Bbushay@xxxxxxxxx
.



Relevant Pages

  • sql 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)
  • 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 question
    ... from otrequests o, otperiodsLkup p ... You are inner joining employee to outrequests, not to otperiodsLkup, so ...
    (borland.public.delphi.database.ado)