Menus

Tuesday 22 November 2016

MySQL Tutorials



mysql “Where not in” using two columns


Use this

SELECT *
FROM CompletedTasks
WHERE (userID, taskID) NOT IN
      ( SELECT userID, taskID
        FROM PlannedTasks
      ) ;


MySQL date format  in SELECT * query


Use DATE_FORMAT:
SELECT *, DATE_FORMAT(date, "%m-%d-%y") AS date FROM my_table;

DATE_FORMAT(created_date,'%d-%m-%y') AS created_date


MySQL ROUND() Function

Round the number to 2 decimal places:

SELECT ROUND(235.1582);

Result: 235.16




No comments:

Post a Comment