I have a standard SELECT query as follows:
SELECT eid, title, content, thumb_image FROM diary ORDER BY eid DESC LIMIT 3
...and a SELECT SUBTRING query as follows:
SELECT SUBSTRING(content, 1, 200) FROM diary
I'd like to combine the two so that it selects the latest 3 entries in the table and displays them with a limit of 200 characters. At the moment I've tried the following which has proven to ignore all entries that are more than 200 characters:
SELECT eid, title, content, thumb_image FROM diary WHERE content IN (SELECT SUBSTRING(content, 1, 200) FROM diary) ORDER BY eid DESC LIMIT 3
I've tried multiple variations of putting the substring query next to where content is selected with little success:
SELECT eid, title, content IN (SELECT SUBSTRING(content, 1, 200) FROM diary), thumb_image FROM diary ORDER BY eid DESC LIMIT 3
SELECT eid, title, content IN (SELECT SUBSTRING(content, 1, 200)), thumb_image FROM diary ORDER BY eid DESC LIMIT 3
SELECT eid, title, content IN (SELECT SUBSTRING(1, 200)), thumb_image FROM diary ORDER BY eid DESC LIMIT 3
Some help would be great, I offer virtual high fives as a reward ;) and maybe some rep power ;)