raulgonzalez
11-19-2007, 05:14 PM
Hello,
I wanted to do the following:
Select the last 7 records from MySQL and out of those 7 records only disply 1 ramdomly.
I tried:
SELECT * FROM pdf ORDER BY RAND() DESC limit 7
But it returns 7 records
I tried:
SELECT * FROM pdf ORDER BY RAND() DESC limit 1
But it returns 1 record from the whole database instead of the last 7 entires.
Any idea how I can accomplish that. I haven't searched, I thought I should ask first before jumping into a research.
Any ideas?
Thanks.
I wanted to do the following:
Select the last 7 records from MySQL and out of those 7 records only disply 1 ramdomly.
I tried:
SELECT * FROM pdf ORDER BY RAND() DESC limit 7
But it returns 7 records
I tried:
SELECT * FROM pdf ORDER BY RAND() DESC limit 1
But it returns 1 record from the whole database instead of the last 7 entires.
Any idea how I can accomplish that. I haven't searched, I thought I should ask first before jumping into a research.
Any ideas?
Thanks.
