SQL subquery woes. - TechRepublic
Question
November 25, 2008 at 01:09 PM
tbrown

SQL subquery woes.

by tbrown . Updated 17 years, 7 months ago

Let me preface this by saying I’m a poweruser sort of fella with a BA in anthropology. I basically fell into a BI/IS/DBA/report development role in addition to other random things.

I basically had to pick up a working knowledge of SQL, and I can get most tasks I need done fairly well, almost all of which result in data sets that I process through Crystal Reports ’08.

My current predicament is trying to figure out how to get the value of an int field for the maximum datetime value for a combination of two other identifiers, excluding all rows where the field value is 10, and have that int return for all rows of the two-ID combo. As that probably makes limited to zero sense, here’s what I want in terms of fields:

CandidateID, JobID, Status, DateTime, Stage, FinalStageDateTime, FinalStage

Status is an unrelated char field describing the activity. I’m not sure if this would be best served by a subquery or some sort of join I haven’t tried yet. The final goal is to be able to sort CandidateIDs within a JobID group based on their last stage before being disqualified (stage 10).

I apologize ahead of time if the explanation is a bit convoluted, I’m an admitted n00b at this stuff and this particular project is turning my hair gray early.

This discussion is locked

All Comments