Hi Guys,

I have a table named "symbols". I am writing the below query.

select  lower(pattern), id  from symbols where value1 = ?1 or value2 = ?1

This returned the following results.

"chu", "20851"
"chchu", "20879"
"cchu", "20907"
"chu", "20935"

>From this, I need only distinct patterns. So I tried this query.

select  distinct(lower(pattern)) as pattern, id  from symbols where
value1 = ?1 or value2 = ?1  group by pattern

This returns

"cchu", "20907"
"chchu", "20879"
"chu", "20935"

This is distinct set of patterns, but I am not getting the list
ordered by id. Even if I add a "order by id" to the above query, it
sorts only the above set. But what I need is to get in the following
order.


"chu", "20851"
"chchu", "20879"
"cchu", "20907"

This is ordered by id and only distinct patterns. I am not able to
come up with a query which does the above. Any help would be great.


--
Thanks
Navaneeth
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to