where in multiple columns mysql code example

Example 1: mysql count multiple columns in one query

mysql count multiple columns in one query:
 SELECT 
        count(*)             as count_rows,
        count(col1)          as count_1,
        count(col2)          as count_2,
        count(distinct col1) as count_distinct_1,
        count(distinct col2) as count_distinct_2,
        count(distinct col1, col2) as count_distinct_1_2
    FROM `table` ;

Example 2: update multiple columns in mysql

UPDATE newpurchase 
SET receive_qty = 20, pub_lang = 'Hindi', receive_dt = '2008-07-10' 
WHERE purch_price > 50;

Tags:

Php Example