query question

Discussion in 'MySQL' started by kabucek, Oct 15, 2008.

  1. #1
    hi @ll,

    is it possible to display data from tables,
    but with given values for certain colums?
    for example:

    select * from 'table1', 'table2', 'table3' where table2.itemID=['003', '005', '009'];

    - I don't know the syntax , this is just my idea

    thanks
     
    kabucek, Oct 15, 2008 IP
  2. mwasif

    mwasif Active Member

    Messages:
    816
    Likes Received:
    23
    Best Answers:
    1
    Trophy Points:
    70
    #2
    For that you need JOIN but you should have a common column between 2 tables to join them.
     
    mwasif, Oct 15, 2008 IP
  3. ranabra

    ranabra Peon

    Messages:
    125
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Speaking from experience, meaning I learnt the hard way :)
    After you have learnt using JOINS (as 'masif' recommended) make use you apply the join in an effective manner.
    Using joins the wrong way, not in an optimal way will still work, but the execution time of your query may take much longer than it should
     
    ranabra, Oct 15, 2008 IP
  4. mwasif

    mwasif Active Member

    Messages:
    816
    Likes Received:
    23
    Best Answers:
    1
    Trophy Points:
    70
    #4
    It is mwasif not masif:)
     
    mwasif, Oct 16, 2008 IP