Query Help Please

  • Mike Feuti (12/9/2008)


    O

    --===== Insert the test data into the test table

    INSERT INTO #test

    (ID, email)

    SELECT '10002','Walton@email.chop.edu' UNION ALL

    SELECT '10004','craig.engstrom@wfhc.org' UNION ALL

    SELECT '10007','earhart.fay@hunterdonhealthcar' UNION ALL

    SELECT '10018','owen.raysor@us.army.mil'

    --===== Insert the test data into the test table

    INSERT INTO #test2

    (ID, product_type)

    SELECT '361708','committee/150' UNION ALL

    SELECT '361865','committee/170' UNION ALL

    SELECT '362184','committee/190' UNION ALL

    SELECT '362215','committee/150' UNION ALL

    SELECT '362261','be78' UNION ALL

    SELECT '362319','bf129'

    What's the link between the two? How do I tell from this which people (email addresses) are on which committees?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Not sure if this answers your question or not but I want the email addresses and ID for anyone on any committtee. the ID's are the link between the two tables. In table one there is only one ID and in table two there can be many because people can have many activities and each is linked by ID back to the first table. Did I answer your question?

  • Mike Feuti (12/9/2008)


    Not sure if this answers your question or not but I want the email addresses and ID for anyone on any committtee. the ID's are the link between the two tables. In table one there is only one ID and in table two there can be many because people can have many activities and each is linked by ID back to the first table. Did I answer your question?

    Not really.

    In the sample data that you gave, who is on what committee? If it's the IDs that link them, that sample data's useless as none of the IDs match.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Gotta leave for today. I'll try this again tomorrow.

    Thank you all for your time.

Viewing 4 posts - 16 through 18 (of 18 total)

You must be logged in to reply to this topic. Login to reply