开发者

mysql:show all value of three fields

开发者 https://www.devze.com 2023-01-05 09:12 出处:网络
i have a q开发者_JS百科uestion... i have a DB..i\'m just want to show all value of 3 fields from DB,they are Line,Model,and NIK...

i have a q开发者_JS百科uestion... 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消