Mysql join tabel

Discussion in 'MySQL' started by egemens, Apr 15, 2011.

  1. #1
    +table1
    -id
    -day
    -month
    -year
    -price

    1 | 04 | April | 2011 | 100
    2 | 12 | April | 2011 | 150


    +table2
    -id
    -day
    -month
    -year
    -credit

    1 | 10 | April | 2011 | 50



    while ($detail =mysql_fetch_array($sql))
    {
    day | month | year | credit | price
    }


    04 | April | 2011 | 00 | 100
    10 | April | 2011 | 50 | 0
    12 | April | 2011 | 00 | 150



    How can I do?

    Thank you very much for helping.
     
    egemens, Apr 15, 2011 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    What columns are the same in each table? Is there a matching id column in both, or would it be dates?

    Also, not sure what software you're using, but you would be better off combining these into a single table from what I can see.
     
    jestep, Apr 15, 2011 IP
  3. codeartist

    codeartist Peon

    Messages:
    96
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    man please recreate your table you dont need 2 tables. you can have credits field in table 1 itself since there is no connection between table 1 and table 2
     
    codeartist, Apr 18, 2011 IP
  4. rajeev_seo

    rajeev_seo Peon

    Messages:
    211
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    using join its possible
     
    rajeev_seo, Apr 24, 2011 IP