swine 0 Posted October 1, 2012 Report 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 Quote Link to post Share on other sites
niche 139 Posted October 1, 2012 Report Share Posted October 1, 2012 I would use php to answer that question. I don't think there's a sql solution to it. Quote Link to post Share on other sites
swine 0 Posted October 1, 2012 Author Report 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. Quote Link to post Share on other sites
niche 139 Posted October 1, 2012 Report 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 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.