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.

 

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.