My SQL looks something like this:
SELECT CompanyName , LastName , FirstName FROM ... JOIN ... ORDER BY CompanyName , LastName , FirstName
Now the problem is that column A is sometimes empty (either as NULL or "" ), and I don't want all these results to appear at the end.
In this example, I would like the fourth entry (which starts with the letter C) to be the third. But if I just ORDER, this will happen:
Avagax Bauer Frank Bele AG Smith John Mork AG Baggins Frodo Chen Jun
In addition, sometimes I get more ordinal columns in several cases, more or less important. This may be relevant.
Additions: either the surname or the company should have a useful line. The name is completely optional. PostgreSQL system (8.4, can migrate up to 9), as well as SQLite. Provider independence would be a plus because there are potential customers who are already using Oracle and SQLServer.
source share