Not sure if H2 supports the derived columns but if it does you can create a derived column say 'ident' which shall be saved as substring(value, 0, 1).

Now table has 3 columns id, value, ident.

Now fire the query against ident.

HTH (with or without derived column)

regards
Navjot Singh

----- Original Message ----- From: "Rene Kohling" <[email protected]>
To: "H2 Database" <[email protected]>
Sent: Wednesday, August 10, 2011 12:38 PM
Subject: String compare with condition


Hello,

my database knowledge is not the best, so I hope someone could give me
a hint to solve a problem.

I have a table, e.g.

id | value
1  | ABC
2  | ADP
3  | FAB123C
4  | FAA000A-BD999Z
5  | M1123
6  | M2000-M2999

first character of value is an identifier, the remaining characters
are either a value or a range

Searching for id where value = FAB123C should return 3 and 4. What is
the easiest/fastest way to solve this? I would be very glad for every
hint.

Rene


--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.



--
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to