joined:Mar 12, 2004
I consider myself pretty good at writing SQL queries, but there's one thing I've never figured out how to do.
I need to sort records by multiple columns and not just by one column after the other. This has got to be a common practice, but I can't even find the right words to search for to figure out how to do this.
In other words, an 'ORDER BY ColumnA, ColumnB' will list records in order of ColumnA and use ColumnB only as a tie breaker if more than one record has the same value in ColumnA. This won't work for what I'm trying to do.
I need to be able to provide search criteria for ColumnA and ColumnB and retrieve a list of records which most closely match both columns, and preferably be able to specify a weighting for whichever column is most important.
Can anyone point me in the right direction for this?