Category Archives: MySQL

GROUP_CONCAT with JOIN in MySQL

GROUP_CONCAT with JOIN in MySQL The GROUP_CONCAT function concatenates strings from a group into one string with various options. Usage of GROUP_CONCAT with JOIN Product Table product_id name 1 abc 2 adc product_to_category table: product_id category_id 1 1 2 1 2 2 2 3 1 3 category_description table: category_id name 1 A 2 B 3… Read More »

How to convert date MM/DD/YYYY to YYYY-MM-DD

How to convert date MM/DD/YYYY to YYYY-MM-DD In real time development we usually come across this issue. But converting the date MM/DD/YYYY to YYYY-MM-DD is really simple using the PHP date function and strtotime() function. In many cases we show different date format like MM/DD/YYYY to users in the application but we need to convert… Read More »

MySQL select data between two dates

MySQL select data between two dates In this tutorial i would like to explain you how to select data between two dates in MySQL. We can use MySQL’s BETWEEN keyword with where clause in a select statement. BETWEEN keyword is used to replace the greater than equal and less than equal condition.

Let’s make… Read More »

How to check null values for multiple columns in mysql where clause

How to check null values for multiple columns in mysql where clause Lets say that we want to check and list the users who’s mandatory fields are null or empty. To acheive this we can use mysql CONCAT(),LEAST() function. SELECT * FROM manage_users WHERE CONCAT(<list of columns>) is NOT NULL and id=’1′ This will check… Read More »