Welcome to WebmasterWorld Guest from 54.160.163.163

Forum Moderators: open

Message Too Old, No Replies

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

     

skoff

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

5+ Year Member



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

DrDoc

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

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



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.

skoff

1:00 pm on Oct 8, 2013 (gmt 0)

5+ Year Member



what about the Aggregate Functions for each field in the select

DrDoc

4:36 pm on Oct 9, 2013 (gmt 0)

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



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.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month