Re: Tricky Sorting

2007-04-02 Thread Shannon Appelcline
I think you're right and using an IF is ultimately the right answer. However just substituting issuenum for issuedate doesn't do the right thing. Looking at my sorting a bit more analytically I think that what I need to do is, WHEN there isn't a month number, THEN substitute the existing month nu

Re: Tricky Sorting

2007-04-02 Thread Brent Baisley
That should be fairly easy. What you are looking to do is have your sort field conditional. The ORDER BY doesn't have to specify a database field, it can be any field in your query. So you could do something like this: SELECT IF( issuemonth IS NULL, issuenum, issuedate) AS sortfield, issuedate,