Welcome to WebmasterWorld Guest from 50.17.16.177

Forum Moderators: open

Message Too Old, No Replies

question about select distinct and/or join and/or group by

     
9:00 pm on Oct 7, 2013 (gmt 0)

Junior Member

5+ Year Member

joined:Nov 16, 2008
posts: 136
votes: 0


Hi! I am always mixed up between this stuff and i need it to be clear for something i need to do.

I have a table with tasks in it. the same task can be there more than 1 time. So i need them to be unique (group by, distinct?!?!) when i do my select query. But the problem is that i need the rest of the fields associated with this task to be shown­. I tried with distinct but it applies to all fields in the select statement from what i've understand. so how can i make this work. I hope im clear enough!

thanks
9:04 pm on Oct 7, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 15, 2002
posts:6807
votes: 0


GROUP BY
is probably what you want. It is much more efficient since it uses the table index(es) rather than evaluating the result set.
1:00 pm on Oct 8, 2013 (gmt 0)

Junior Member

5+ Year Member

joined:Nov 16, 2008
posts: 136
votes: 0


what about the Aggregate Functions for each field in the select
4:36 pm on Oct 9, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 15, 2002
posts:6807
votes: 0


There was no mention of aggregate functions ... Any one in particular you are concerned with? It sounds like you may need to use groupings and/or sub-queries.

I'm sorry if I'm being vague, but I only have vague details to base my answers on.

An example (even greatly simplified and examplified) would be great.