Link to home
Start Free TrialLog in
Avatar of rutgermons
rutgermons

asked on

specify yorn if field is populated in other relationsal table

folks

i have two tables

workorder and asset

in my asset table I have data like so

asset    contract
car1      waranty1
car1      waranty2
car2      null
car3      repair


in my workorder table i have three fields

workid     asset  description
1             car1    broken
2             car2    inop


how can i add a field into my query to state in YORN form if the contract field is present
to that specific asset in my asset table like so

workid     asset  description    contracts exist?
1               car1    broken              Y
2               car2    inop                  N

All help will do


r
   
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

select a.*, case when w.workid is null then 'N' else 'Y' end contract_exists
from asset a
left join workorder w
  on w.asset = a.asset
ASKER CERTIFIED SOLUTION
Avatar of GGuzdziol
GGuzdziol
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial