Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2006
    Location
    south jersey, usa
    Posts
    53

    Unanswered: help create query against two tables

    stepdefinition has
    steptype
    flowid
    stepid

    task has
    taskid
    flowid
    stepid

    flowid and stepid for both tables match; meaning that if i found a record in task with a certain taskid, i could query stepdefinition with the same flowid and stepid to find the steptype.

    well, i wanna do it the other way around. I query stepdefinition to find a list of flowids and stepids for a specific steptype.

    select flowid, stepid from stepdefinition where steptype = -3

    Now, I want to find all taskids in task for each flowid/stepid combination

    here's a visual

    http://www.filecabin.com/up1/1144249279-task.gif
    "They say Moses split the Red Sea
    I split the blunt and rolled the fat one, I'm deadly"
    -- Tupac 'Blasphemy'

  2. #2
    Join Date
    Mar 2006
    Location
    south jersey, usa
    Posts
    53
    Code:
    select taskid from task 
    where stepID+flowID in
    	(select stepID+flowID from stepdefinition where steptype = -3)
    order by taskid
    works
    "They say Moses split the Red Sea
    I split the blunt and rolled the fat one, I'm deadly"
    -- Tupac 'Blasphemy'

  3. #3
    Join Date
    May 2002
    Location
    General Deheza, Cba, Arg.
    Posts
    276
    select t.taskid, t.stepID, t.flowID
    from task as t
    join stepdefinition as s
    on ( t.stepID = s.stepID
    and t.flowID = s.flowID )
    where s.steptype = -3

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •