Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySql Distinct with multiple fields

I have 4 columns a, b c, d in my table (MySQL database) . I want to select the distinct values of ALL of these 4 columns in my table . More deeply my table is given bellow..

a   b   c   d
--------------------------
1   3   3   4
1   2   3   0
1   1   3   4
1   2   3   4
1   2   3   4
1   2   3   4
1   2   3   4

In the above table (1,2,3,4) value are repeating 4 times(look the last 4 rows of my table). I want only the distinct one , ie i want to get the bellow table after mysql query..

a   b   c   d
---------------
1   3   3   4
1   2   3   0
1   1   3   4
1   2   3   4

I think you guys got some idea . Im not familier with MySql .

like image 323
freakydev Avatar asked Dec 26 '22 11:12

freakydev


2 Answers

select distinct a,b,c,d from your_table
like image 187
juergen d Avatar answered Dec 28 '22 07:12

juergen d


SELECT DISTINCT column_name,column_name FROM table_name;

I mean

select distinct a,b,c,d from table_name;

Here is the link of w3schools

like image 31
Sulthan Allaudeen Avatar answered Dec 28 '22 08:12

Sulthan Allaudeen