|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
The following SELECT returns no record:
SELECT * from ((t1 LEFT JOIN t2 on t1.f1=t2.f1) LEFT JOIN t3 on t1.f2=t3.f2) ORDER BY t1.f1 However by getting rid of "ORDER BY" clause: SELECT * from ((t1 LEFT JOIN t2 on t1.f1=t2.f1) LEFT JOIN t3 on t1.f2=t3.f2) will return all the records. Why? Please advise. |
|
#2
|
|||
|
|||
|
Not positive on this one, but there may be some restrictions on using things like ORDER BY and GROUP BY on left joined queries, as there's a risk that there could be NULL values floating round in funny places (e.g. in your example, you may have a bunch of t1.f1 values with no corresponding t2.f1 values). This doesn't entirely make sense -- you may have a hit a bug -- but it might offer some reason as to why the bug is there. Get onto one of the MySQL mailing lists and pose your question there.
|
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > "ORDER BY" failed when using "LEFT JOIN" |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|