1SELECT
2 GROUP_CONCAT(DISTINCT id SEPARATOR ', ') AS 'ids'
3FROM
4 table_name
5WHERE
6 column_name = 'value'
1mysql count multiple columns in one query:
2 SELECT
3 count(*) as count_rows,
4 count(col1) as count_1,
5 count(col2) as count_2,
6 count(distinct col1) as count_distinct_1,
7 count(distinct col2) as count_distinct_2,
8 count(distinct col1, col2) as count_distinct_1_2
9 FROM `table` ;
1-- MySQL
2-- t1 = table1
3-- dt2 = column of table
4SELECT t1.dt2, t2.dt4, t2.dt5, t2.dt3 #get dt3 data from table2
5FROM table1 t1, table2 t2 -- Doesn't need to have t1, or t2
6WHERE t1.dt2 = 'asd' AND t2.dt4 = 'qax' AND t2.dt5 = 456
7