| | |
MySQL query ignoring "ORDER BY" clause?
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Jun 2009
Posts: 15
Reputation:
Solved Threads: 0
Good morning/afternoon/evening!
I'm trying to run a MySQL query, but it seems to be ignoring the "ORDER BY" clause, most likely, I'm believing, because I'm using the "IN" keyword in my query (several times, as a matter of fact, along with a "LIKE"). Is there a way I can structure my query, so that it will use the "ORDER BY" clause? I've included an example of the query below:
Thanks for any suggestions you can provide!
I'm trying to run a MySQL query, but it seems to be ignoring the "ORDER BY" clause, most likely, I'm believing, because I'm using the "IN" keyword in my query (several times, as a matter of fact, along with a "LIKE"). Is there a way I can structure my query, so that it will use the "ORDER BY" clause? I've included an example of the query below:
MySQL Syntax (Toggle Plain Text)
SELECT * FROM Ships, Accounts WHERE Available_Loads.Action != 'D' AND Ships.Username = Accounts.Username AND Ships.Username != 'demo' AND Ships.Status != 'inactive' AND Ships.PU_Date >= CURRENT_DATE() AND Ships.Shipment_Type LIKE '%' AND Ships.Required_Equipment IN ('AC', 'DD') AND Ships.Origin_Country IN ('USA') AND Ships.Origin_State IN ('TX') AND Ships.Origin_City IN ('ALLEN', 'ARGYLE', 'ARLINGTON', 'AUBREY', 'BEDFORD', 'CARROLLTON', 'CEDAR HILL', 'CELINA', 'COLLEYVILLE', 'COPPELL', 'DALLAS', 'DENTON', 'DESOTO', 'DUNCANVILLE', 'EULESS', 'FLOWER MOUND', 'FORT WORTH', 'FRISCO', 'GARLAND', 'GRAND PRAIRIE', 'GRAPEVINE', 'HURST', 'IRVING', 'KELLER', 'LAKE DALLAS', 'LAVON', 'LEWISVILLE', 'LITTLE ELM', 'MCKINNEY', 'MELISSA', 'MESQUITE', 'NORTH RICHLAND HILLS', 'PLANO', 'PRINCETON', 'PROSPER', 'RICHARDSON', 'ROANOKE', 'ROWLETT', 'SOUTHLAKE', 'SUNNYVALE', 'THE COLONY', 'WYLIE') AND Ships.Dest_Country IN ('USA') AND Ships.Dest_State IN ('LA') ORDER BY 'PU_Date ASC'
Thanks for any suggestions you can provide!
•
•
Join Date: Aug 2007
Posts: 55
Reputation:
Solved Threads: 9
MySQL Syntax (Toggle Plain Text)
AND Ships.Dest_State IN ('LA') ORDER BY 'PU_Date ASC'
•
•
•
•
Try removing the ASC from the quotes !MySQL Syntax (Toggle Plain Text)
AND Ships.Dest_State IN ('LA') ORDER BY 'PU_Date ASC'
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
•
•
Join Date: Aug 2007
Posts: 55
Reputation:
Solved Threads: 9
MySQL Syntax (Toggle Plain Text)
...AND Ships.Dest_State IN ('LA') ORDER BY 'PU_Date' ASC
Don't forget to mark as solved, if solved
![]() |
Similar Threads
- Need Help With Updating An Order Form using PHP/MYSQL (PHP)
- test mysql query for no results (PHP)
- Mysql query taking unexpectedly long time to execute (MySQL)
- simple php/mysql query not working as I want it to (PHP)
- Double MySQL Query (PHP)
- Python Tuples and Mysql Query (MySQL)
- MySQL query's (MySQL)
- Change MySQL Query Timeout Period (MySQL)
- google "keyword" question (Search Engine Optimization)
Other Threads in the MySQL Forum
- Previous Thread: Empty result set
- Next Thread: how to query the first 4 letters and the last 4 letters of field
| Thread Tools | Search this Thread |
Tag cloud for MySQL
1 agplv3 alfresco api artisticlicense aws bizspark breathalyzer camparingtocolumns changingprices cmg communityjournalism contentmanagement contractors copyright court crm data database design developer development distinct dui eliminate email enter enterprise error eudora facebook form foss gnu government gpl greenit groupware hiring hyperic images innerjoins insert ip joebrockmeier join keyword keywords kickfire laptop law legal license licensing linux maintenance managing mariadb matchingcolumns metron microsoft microsoftexchange montywidenius multiple music mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opengovernment opensource operand oracle penelope php query referencedesign reorderingcolumns results resultset saas search select sharepoint simpledb sourcecode spotify statement sugarcrm syntax techsupport thunderbird transparency update virtualization






