Moron Posted February 12, 2009 Share Posted February 12, 2009 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. Quote Link to comment Share on other sites More sharing options...
aebstract Posted February 12, 2009 Share Posted February 12, 2009 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. Quote Link to comment Share on other sites More sharing options...
Moron Posted February 12, 2009 Author Share Posted February 12, 2009 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. Quote Link to comment Share on other sites More sharing options...
aebstract Posted February 12, 2009 Share Posted February 12, 2009 Is PA.[PSTU57] a valid column name? Is it suppose to have the []? Quote Link to comment Share on other sites More sharing options...
Moron Posted February 12, 2009 Author Share Posted February 12, 2009 It's fixed. I forgot to adjust this in my second query, the one that actually pulls the results. It explains my username. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.