Hi, Given a table like the following:
CREATE TABLE IF NOT EXISTS Data (uuid TEXT, info TEXT); with data like: C94464EB|foo/x1 8A740A4C|foo/x2 FBC49814|bar/x1 F9B0921F|bar/y1 1914F587|bar/y2 E51EC596|baz/a1 549298B6|baz/a2 822DC1A8|foo/x2/a1 46F2854F|foo/x1/a1 47FE9DB1|bar/z1 841716A3|bar/y1/b1 BF965FFA|baz/x1 I want to get the uuids in order as if `foo`, `bar` and `bar` were different columns, e.g. if the desired order were "bar ASC, foo DESC, baz ASC" I would want to retrieve the data in this order: FBC49814|bar/x1 F9B0921F|bar/y1 841716A3|bar/y1/b1 1914F587|bar/y2 47FE9DB1|bar/z1 822DC1A8|foo/x2/a1 8A740A4C|foo/x2 46F2854F|foo/x1/a1 C94464EB|foo/x1 E51EC596|baz/a1 549298B6|baz/a2 BF965FFA|baz/x1 (I only actually need the `uuid`; I'm just repeating the `info` for clarity here.) NB the number of sort types like `foo`, `bar` and `baz` can vary. And this is for usage through the C API, so prepared queries would be ideal, but I can use custom functions if need be. I can easily think of how I would approach it if I didn't need the different types to be able to have different ASC and DESC; but I haven't been able to devise an general approach. Can anyone give me any ideas? Many thanks, Hamish _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users