mysql select multiple rows into one column 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: how to select multiple columns from different tables in mysql
SELECT t1.dt2, t2.dt4, t2.dt5, t2.dt3
FROM table1 t1, table2 t2
WHERE t1.dt2 = 'asd' AND t2.dt4 = 'qax' AND t2.dt5 = 456