How to use NULL or empty string in SQL

If we need to find records that have either null values or an empty string in sql sub querys like below.

If useing more than two tables in SQL joins concepts.

Querys useing if and else condations.

$sql = " select t1.*, t3.*,IFNULL('select t2.column_name from table_2 t2 where t1_column=t2_column', '0') as col_value from table_1 t1, table_t3 where t1_column=t3_column' ";

  • In this query
  • To find rows where columns is NULL
  • If the sub query columns are empty it is return the 0 values printed


Sign In or Register to comment.