database - Problems with LEFT JOIN in MySQL -


i have little problem mysql query. i'm using left join table1 , table2. many rows in table2 can match 1 row in table1. know left join stop searching when finds 1 match row, seems randomly. when sort table2 doesn't take first match row.

do know maybe solution?

example:

table1

date1      | ----------- 2010-10-10 | 2010-10-10 | 2010-10-10 | 

table2

date2      | item ------------------------- 2010-10-09 | item1 2010-10-08 | item2 2010-10-07 | item3 

sql query

select * table1 left join table2 on date2<=date1 

i expect

date1      | date2       | item -------------------------------------- 2010-10-10 | 2010-10-09  | item1 2010-10-10 | 2010-10-09  | item1 2010-10-10 | 2010-10-09  | item1 

but i'm getting f.e

date1      | date2       | item -------------------------------------- 2010-10-10 | 2010-10-09  | item1 2010-10-10 | 2010-10-08  | item2 2010-10-10 | 2010-10-09  | item1 

i know left join stop searching when finds 1 match row

left join doesn't @ all. returns matching rows. if you're having behavior can't explain posting entire query you.


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -