jeudi 24 mars 2016

selecting a distinct value of column 2 where column one is equal to a certain value

Basically at current i have some script that allows my users to see all distinct values of 'make' which shows the distinct values of a b c ect. But under each of make there is another column which is models. i would like to be abel to select all distinct values of the models column where the make column is equal to a certain make.

Is this possible? if so if someone could point me in the right direction it would be helpful.

current code as follows:

$sql = "SELECT * FROM table_name WHERE make=146";

i would like it to

//SELECT ALL DISTINCT VALUES FROM Column_Name2 where Column_Name1=146.

Surely this is possible and i just can't figure out which function i need to solve my solution.

Many Thanks in Advance.




Aucun commentaire:

Enregistrer un commentaire