1

I want to display value based on distinct month but it will not show the distinct month it show the repeat month.

"select DISTINCT {fn MONTHNAME(entrydate)} AS monthname, emirate_name, location, price, bedroom from itf_property where emirate_name='Dubai' and location='Dubai Marina' and bedroom='1' order by id";

It show the result like attached images

enter image description here

1 Answer 1

2
"select DISTINCT {fn MONTHNAME(entrydate)} AS monthname, emirate_name, location, price, bedroom from itf_property where emirate_name='Dubai' and location='Dubai Marina' and bedroom='1' order by id GROUP BY monthname";

Should work.

2
  • Yup its working using group by but why its not working for distinct any idea Sep 23, 2015 at 12:44
  • If you want distinct name, you must decide which of the multiple values that may occur for each distinct name you want. For example, you may want minimals, or counts, for example SELECT name, min(type), min(state), count(country) FROM table GROUP BY name Sep 23, 2015 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.