MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 20th, 2000, 10:40 AM
weihong weihong is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2000
Posts: 1 weihong User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old October 28th, 2000, 05:52 AM
christucker2 christucker2 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Posts: 81 christucker2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > "ORDER BY" failed when using "LEFT JOIN"


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT