Fog Creek Software
Discussion Board




SORTING

Is there a limit on how many secondary key fields you can sort on?

FUNNY
Wednesday, August 04, 2004

If you're talking about the unix sort command, I've used 3.  If you're talking about something else, like a SQL query, you should learn to be more specific.

Snotnose
Wednesday, August 04, 2004

Given zero constraints of your problem?

The only answer is

The max number of fields you can sort on is going to be equal to the number of fields you have in the table.

I suppose one might ask is there any valid reason to have MORE sort criteria then the number of fields in a table? (I don’t think so…but I am open to suggestions here!)


Albert D. Kallal
Edmonton, Alberta Canada
kallal@msn.com
http://www.attcanada.net/~kallal.msn

Albert D. Kallal
Wednesday, August 04, 2004

Ahhh...

But what about secondary key fields composed of more than 1 field, or secondary key fields composed of portions of a field...

Hiding near WEM
Wednesday, August 04, 2004

If you nest queries then you can concatenate fields and sort or group on the results on some SQL engines, but not all.

If you can't then you have to use intermediate steps.

Simon Lucy
Wednesday, August 04, 2004

*  Recent Topics

*  Fog Creek Home