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:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old June 19th, 2000, 07:07 PM
ihatzi ihatzi is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 2 ihatzi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I am using MySQL and cant seem to get an ORDER BY and LEFT JOIN to work in the same SELECT statement.

Is this an illegal statement?

SELECT MsgParent, MsgID, MsgBody, MsgEvent, UserFirstName, UserLastName, UserCoName FROM msgbrd LEFT JOIN users ON msgbrd.MsgBy = users.UserName ORDER BY MsgEvent

The Statement works as long as there is not an ORDER BY and JOIN in the same statement....

HELP!

Thanx

Reply With Quote
  #2  
Old June 19th, 2000, 10:33 PM
Robert_J_Sherman
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
As I read the mySQL and mSQL book from O'Reilly, I understand that the use of
"LEFT JOIN" is unnecessary..

In this example I am performing a join of information for 2 tables, and then "order by" in "ascending order"...

SELECT customer_id,account_num,name,company_name,host_acct,status,account_types.acct_type FROM customers, account_types
WHERE account_types.acct_type_id=customers.acct_type_id
ORDER BY customer_id ASC

And I have experienced no problems,

------------------
SnR Graphics,
Low Cost Hosting and Web Development.

Reply With Quote
  #3  
Old June 20th, 2000, 03:27 AM
ihatzi ihatzi is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 2 ihatzi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hmmm...

I tried it and it still does not work...

Here is my SQL Statement....

SELECT msgbrd.MsgParent, msgbrd.MsgID, msgbrd.MsgBody, IF(msgbrd.MsgParent=0, msgbrd.MsgID, msgbrd.MsgParent) AS MsgOrder, DATE_FORMAT(msgbrd.MsgDate, '%m/%d/%y %r') AS MessageDate, msgbrd.MsgEvent, users.UserFirstName, users.UserLastName, users.UserCoName FROM msgbrd, users WHERE msgbrd.MsgBy = users.UserName ORDER BY MsgOrder ASC


<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by Robert_J_Sherman:
As I read the mySQL and mSQL book from O'Reilly, I understand that the use of
"LEFT JOIN" is unnecessary..

In this example I am performing a join of information for 2 tables, and then "order by" in "ascending order"...

SELECT customer_id,account_num,name,company_name,host_acct,status,account_types.acct_type FROM customers, account_types
WHERE account_types.acct_type_id=customers.acct_type_id
ORDER BY customer_id ASC

And I have experienced no problems,

[/quote]


Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > ORDER BY with 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 2 hosted by Hostway