Hi All
I am struggling with a query.
I have 3 tables:
Job Key: jobNumber (int).
Stage Key: StageID (int)
Foreign Keys: JobNumber (int), TypeID (int)
Type Key: TypeID (int)
Other: DisplayName (varchar)
Each Job has various stages in the Stage Table and each stage has one type. The Type is used to determine the stage order.
What I want is to display each job and show the MAX(typeid) for each job along with its display name.
Dont want to display the stages, only one line per job.
I can quite easily get it to work OK, but just cannot figure out how to return the DISPLAYNAME as well!!
select job.jobnumber, max(stage.typeid)
FROM job
LEFT JOIN stage ON stage.jobnumber=job.jobnumber
LEFT JOIN type ON type.typeid=stage.typeid
GROUP BY job.jobnumber
How can I include the display name?
Thanks
ITflash
I am struggling with a query.
I have 3 tables:
Job Key: jobNumber (int).
Stage Key: StageID (int)
Foreign Keys: JobNumber (int), TypeID (int)
Type Key: TypeID (int)
Other: DisplayName (varchar)
Each Job has various stages in the Stage Table and each stage has one type. The Type is used to determine the stage order.
What I want is to display each job and show the MAX(typeid) for each job along with its display name.
Dont want to display the stages, only one line per job.
I can quite easily get it to work OK, but just cannot figure out how to return the DISPLAYNAME as well!!
select job.jobnumber, max(stage.typeid)
FROM job
LEFT JOIN stage ON stage.jobnumber=job.jobnumber
LEFT JOIN type ON type.typeid=stage.typeid
GROUP BY job.jobnumber
How can I include the display name?
Thanks
ITflash