Saturday, June 2, 2012

how to get top 3 records in sql


how to get top 3 records in sql  , or   how to get top 3 (RECENT ) record from mysql

query :

SELECT  * FROM TABL_NAME ORDER BY ID DESC LIMIT 0,3 



how to update multiple rows in mysql with one query with different values



UPDATE `tbname` SET `column_name` = CASE  `id`
WHEN '1' THEN '1'
WHEN '2' THEN '2'
WHEN '3' THEN '3'

END

No comments:

Post a Comment

If you Satisfied , Please Leave a comment