Jump to content

Problem with select distinct


swine

Recommended Posts

Hey there, I have a SQL-statement in a stored procedure returning an employees name and his projects. The names are displayed in a list, and if an employee has n projects, his name is displayed n-times. I want the names to displayed only once, but still n projects. So if I click later on a name, his projects are highlighted or alternatively the others are greyed out. Is there a possibility to get this with only one SQL-statement? I've tried with "select distinct ..." but this doesn't cause any change Thanks for helping

Link to comment
Share on other sites

I would use php to answer that question. I don't think there's a sql solution to it.

Link to comment
Share on other sites

Thanks for the quick answer. I just tried a second SQL which is mostly the same, but only returns the names and distinct works fine.Unfortunately I don't have the skills to say if a php or a second sql is the better solution.

Link to comment
Share on other sites

It's all about the resource that sql returns. You can't target something that's not in the sql resource that's returned. So, just do a mysql_fetch_array (you'll have to know a little php), then a var_dump(), then viola, you'll see what was actually produced.

Edited by niche
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...