|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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. |
|
#3
|
|||
|
|||
|
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] |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > ORDER BY with JOIN |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|