I have a table, lets say table A, with data following same pattern:
How could I Select data when the number is greater than 1, for example?
Right know, I am using:
SELECT * FROM A WHERE col LIKE "%a.b.%"
And then, in java, I manage to get which ones are greater than ab1
Isn't possible to do this in a single query?
(I need to do it in MySql and SQLServer)
If I understand your question correctly, you want to skip all rows where ab1.* and select data starting from ab2.*, so ab2 will be the first possible match for you, and query should look like this:
WITH dataset
AS
(
SELECT 'a.b.1.c' AS List
UNION ALL
SELECT 'a.b.2.c'
UNION ALL
SELECT 'a.b.3.c'
UNION ALL
SELECT 'a.b.3.d'
)
SELECT * FROM dataset
WHERE List >= 'a.b.2'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.