I have a table with
'id' as the primary field and set to auto increment..
'name' of type varchar ..
'category' of type varchar ..
Table contents ::.
* id=1,name=abc,category=tv
* id=2,name=abc,category=radio
* id=3,name=abc,category=tv
* id=4,name=abc,category=radio
* id=5,name=abc,category=tv
* id=6,name=abc,category=tv
Now, I want to select latest rows where category="tv" i.e row 5, row 6 only
This is just an example the real table might have many categories, I hope I am clear in the way I am putting forward my issue...
Please help....
from the answers given ...this query is showing results how i want them ::.
SELECT * FROM test WHERE id > (SELECT id FROM test WHERE category !="tv" ORDER BY id DESC LIMIT 1)
but when i add 1 more row to my table the query shown no results which i can understand why..
$$$$I want the final block of a particular category $$$$