mysql left join

Posted by user1019538 on Stack Overflow See other posts from Stack Overflow or by user1019538
Published on 2012-04-03T11:25:01Z Indexed on 2012/04/03 11:30 UTC
Read the original article Hit count: 189

Filed under:

I have two table one is index and another is the price structure as under

table : index : column : trandate ,indexcode

Table : price : Column: trandate,symbol,price

i want to know the missing price.

I issue the query

select i.trandate,i.indexcode,p.trandate,p.price from index i left join price p on i.trandate = p.trandate where p.symbol='ABC' and indexcode="New"

the above query does not show the null date even though various price in missing in price table. Only reason i understand is that the index table does not have the symbol field that's why...but as per theory if you want to show all the rows of one table and only the match value of another table then use the left or right join query...please anybody can help

© Stack Overflow or respective owner

Related posts about mysql