June 17, 2015

MySQL select query to COUNT only unique values.



If you used join query on parent table and child table and you want to fetch unique records from both table then see the below example

SELECT COUNT(DISTINCT(t1.id)) FROM table1 t1 left join table2 t2 on t2.id=t1.t2id

Enjoy!

1 comment:

Integrating Google reCAPTCHA v3 in HTML Form with PHP

  What is Google reCAPTCHA v3? Google reCAPTCHA is a free service that helps protect websites from spam and abuse. reCAPTCHA v3 is the lates...