Posts Tagged Mysql

Mysql rounding for currency format

Most of the time we are used to format float numbers into currency format by PHP (or any front end language) using functions like fprintf(). If we could grab the result formatted from the db, we won’t need to use front end formatting. Mysql function format() is the function we need. Lets say we have […]



Find duplicate entry in table

This is a very handy query all the db programmers and db admins need everyday. Lets say, we have a table “test” with 2 fields “id” and “name”. We need to find out which names are duplicated in the table. So here is the query: select name, count(*) from test group by name having count(*) […]

, ,