Hi,
I have two tables and they have one to many relationship.The two tables are fares and fare preferences.Now in fares table there is a unique user id and username and the user id is related to multiple preferences.Now I want to make a query that displays the username once and its multiple preferences. I have used distinct but it is not working and I have also used group by which is of no use as it will display only one record. Can anyone help.
Thanks in advance

You will have to join them, returning the username in every row, and then use PHP, to display it the way you want. You cannot do this easily with just a query.

Is there any way I can do in mysql query

Give example data and what you want as output. You can look at GROUP_CONCAT though.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.