Good day! i've got some problem with that query:
SELECT `id`
FROM `test`
WHERE `name`
LIKE "somename" AND `id` = (SELECT max(`id`) FROM test)
It returned an empty result.
But
SELECT `id`
FROM `test`
WHERE `name` LIKE "somename"
works.
Moreover,
SELECT `id`
FROM `test`
WHERE `id` = (SELECT max(`id`) FROM test)
works too.
Why they doesn't work together?
Thanks you!
I think you are probably looking for something like this:
SELECT *
FROM
test
WHERE
id=(SELECT max(id) FROM test WHERE name LIKE "somename")
this will return the row from test that has the maximum ID where name is like "somename"