The difficult sort is on a column of bridge bids; e.g.
3NT
1S
2CX
3C
3S
While the suits will sort correctly (clubs, diamonds, hearts, spades) "no trump" or "N" should sort after spades. Of course it doesn't alphabetically. The sloppy solution I've come up with is to have the database hold "T" rather than an "N" for no trump bids - and then make sure that the DrawCell displays "T" correctly as an "N".
(I take it the order you want is 1S, 2CX, 3C, 3S, 3NT)Your solution is a valid one. But there is still a possibility to sort NT before S, H, D, C. Or C, D, H, S and NT if you prefer, low to high.
SELECT *
FROM BIDDINGS
ORDER BY
SUBSTR(BID,1,1),
CASE SUBSTR(BID,2,1)
WHEN 'C' THEN 0
WHEN 'D' THEN 1
WHEN 'H' THEN 2
WHEN 'S' THEN 3
WHEN 'N' THEN 4
ELSE 5
END
I haven't tested this but it should sort by number of tricks (first character in BID) and inside that in order of C, D, H, S and NT.