Can anyone write a code that
How to select distinct and unique records from mysql database desc with limit 4
here is my query i wrote
$q = "SELECT DISTINCT productid FROM table where user='$_SESSION[user]' GROUP BY date ORDER BY uniq_id desc LIMIT 4";
Actually what i want is i need to retrieve last added distinct record(uniq_id) from table...but its randomly retriving
e.g They are totally 8 records in my table..after runnin the code..its showing 4th uniq id..instead of 6th uniq id..i want the 6th record to be displayed
Please give a solution this post..
Thank You !