combine two tables

  • I have two tables:

    Table1 has the list of default choices for the user to select: The listing of the columns are:

    Title Category ID Selected

    ---------------------------

    Beff 4 8002 0

    Chicken 4 8003 0

    Pork 4 8004 0

    SwordFish 5 8005 0

    Haddock 5 8006 0

    Salmon 5 8001 1

    Table2 has the list of all the choices that the user select after completing a page. the list of the column for this table are:

    Category ID Active

    --------------------

    4 8002 1

    4 8003 1

    4 8004 1

    Is it posible to joint the two tables in one query which select Title, Id and Selected columns?

    examples:

    1. if i select Title, ID and Selected columns where category equals 4 and Active = 1 then the result should be like below:

    Title ID Selected

    Beff 8002 1

    Chicken 8003 1

    Pork 8004 1

    if i select Title, ID and Selected column where category equals 5 and Acitve =1 then the result should be like below:

    Title ID Selected

    SwordFish 8005 0

    Haddock 8006 0

    Salmon 8001 1

    Or do it need to do it in 2 seperated queries and manually join them together?

    thanks you,

    SQL newbie.

  • duplicate post.

    discussion already started here .

    Please note that the link contains less information than this thread...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • I don't know how i ended up with two posts. Please remove other post since the question on the other post was only stated not in its entirely.

    I don't whether it should be termed join or merge in SQL language but i would like to produce the result indicated using one query if it is posible.

    thanks

Viewing 3 posts - 1 through 2 (of 2 total)

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