Jump to content

[SOLVED] Why doesn't my "ORDER BY ____ desc" work?


Moron

Recommended Posts

My query (abbreviated):

 

$RESULTDS=mssql_query("SELECT M2.[hrYRAT], PA.[PSTU39], PA.[PSTU54], PA.[PSTU55], PA.[PSTU57]

FROM MASTERL2 M2 

LEFT JOIN PAYSTUBS_Archive PA
ON PA.[PSTUB2]=M2.EMPNO

WHERE PA.[PSTUB2] = '".$_SESSION['empcode']."' 

ORDER BY PA.[PSTU57] desc");

 

In the ORDER BY statement, I can remove the "desc" part and it makes no difference. The field it's ordering by is a date field in the format of 20081115, 20090110, etc... (year, month, day).

 

Thanks!

 

EDIT: I want the most current date on top of the list, thus the "desc" part.

 

It's ordering by PA.[PSTU57] in a descending order, change it to ASC and it will flip the order. You can also change PA.[PSTU57] to something else if you would like to order by another column in your table.

 

I tried it and it makes no difference, either using ASC or removing it completely. It's like it's not recognizing either ASC or DESC for some reason.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.