tags:

views:

16

answers:

1

hi all...i have a question... i have a DB..i'm just want to show all value of 3 fields from DB,they are Line,Model,and NIK... i want it order by insp_datetime field...and descending..limit 0,30..

i've been try like this:

SELECT * FROM Inspection_report
WHERE NIK='".$NIK."' AND Line='".$Line."' AND Model='".$Model."'
ORDER BY Insp_datetime DESC
LIMIT 0,30;

But i think it's wrong..can you give me the correct code?

+1  A: 

Your question isn't entirely clear, but I think what you want is:

SELECT NIK, Line, Model FROM Inspection_report 
   ORDER BY Insp_datetime DESC LIMIT 0,30;

which will give you the NIK, Line, and Model of the most recent 30 inspections.

Larry Lustig