Results 1 to 2 of 2

Thread: Cant figure out how to do a Query. Help please..

  1. #1
    Join Date
    Aug 2005
    Posts
    1

    Cant figure out how to do a Query. Help please..

    I have these 2 tables:

    TABLE 1 - Workflow log
    ------------------------------------------
    UserProcessed FromQueueID To QueueID
    ------------------------------------------
    user0003 4 17
    user0004 5 8
    user0005 6 17
    ------------------------------------------

    TABLE 2 - Workflow
    ------------------------------------------
    WorkflowID Workflow
    ------------------------------------------
    4 Dangerous Goods
    5 Intermodal
    6 Chemical
    8 Suspend
    17 Closed


    Desired Query Result:
    ---------------------------------------------
    UserProcessed From To
    ---------------------------------------------
    user0003 Dangerous Goods Closed
    user0004 Intermodal Suspend
    user0005 Chemical Closed


    What type of query is this called?
    Do I have to do 2 queries and then join the results?
    Can anyone show me the correct way of doing this query?
    This seems like it should be a really easy ....

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    select w.userprocessed, a.workflow as From, b.workflow as To
    from workflowlog as w
    join workflow as a on w.fromqueueid = a.workflowid
    join workflow as b on w.toqueueid = b.workflowid

Posting Permissions

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