Skip to content
Advertisement

how to show all result query even though the results are empty

I count my data from database, but I have a problem with the result. the result only displays data that is not empty, while the empty data is not displayed. how do I display data rows that are empty and not empty?

the result of my query like this

BUT i want the result like this :

i want to show empty data from my database. this is my query

Advertisement

Answer

Try running this query:

Notes:

  • The JOINs have been replaced with LEFT JOINs.
  • Filtering conditions on all but the first table have been moved to the ON clauses.
  • This replaces the meaningless table aliases with table abbreviations, so the table is easier to read.
  • Things that looks like numbers probably are numbers, so I removed the single quotes.
  • This simplifies the counts, using the fact that MySQL treats booleans as numbers in a numeric context.
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement