[sqlite] Select WHERE IN List ordering

2013-04-25 Thread Gary Baranzini

Hi,

I have the following query:

SELECT id  FROM pointslocation  WHERE id IN (1,7,3,4,5,2,6)

What 's returned is 1,2,3,4,5,6,7.

How do I retain the order in the IN list?

jb
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Sort Alphanumeric, Numeric data in a VARCHAR

2010-01-13 Thread Gary Baranzini
Hi,

I'm having trouble sorting the following data:

point_number  - VARCHAR(10)

11.01
11.23
77.01
55.09
A06
1010.01
1010.09
A03

If I do: SELECT point_number FROM mytable ORDER BY point_number;
I get the following:

1010.01
1010.09
11.01
11.23
55.09
77.01
A03
A06

When I do the following:
SELECT point_number FROM mytable ORDER BY point_number+0;

I get the following:

A03
A06
11.01
11.23
55.09
77.01
1010.01
1010.09

I would like to have them ordered in the following sequence:

11.01
11.23
55.09
77.01
1010.01
1010.09
A03
A06

How can I get the A03, A06 at the end of the list?

TIA

gary
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users