swine Posted October 1, 2012 Share Posted October 1, 2012 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 More sharing options...
niche Posted October 1, 2012 Share Posted October 1, 2012 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 More sharing options...
swine Posted October 1, 2012 Author Share Posted October 1, 2012 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 More sharing options...
niche Posted October 1, 2012 Share Posted October 1, 2012 (edited) 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 October 1, 2012 by niche Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now