Can “Distinct” key Word be used twice in a single Select Query? like wise:
select DISTINCT(trackid), DISTINCT(table_name)
from jos_audittrail
where live = 0 AND operation = UPDATE
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, By Default Distinct works on all the columns you are selecting.
eg.
This will select all distinct trackid and table name combination
EDIT
For retrieving distinct records other than this you can use the answer given by davek. It will work.
You can use
group byto do this work as group by is being applied on both the columns being provided so no aggregate function is needed.