homepage Welcome to WebmasterWorld Guest from 54.211.230.186
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

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

5+ Year Member



 
Msg#: 4615196 posted 9:00 pm on Oct 7, 2013 (gmt 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

 

DrDoc

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



 
Msg#: 4615196 posted 9:04 pm on Oct 7, 2013 (gmt 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.
skoff

5+ Year Member



 
Msg#: 4615196 posted 1:00 pm on Oct 8, 2013 (gmt 0)

what about the Aggregate Functions for each field in the select

DrDoc

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



 
Msg#: 4615196 posted 4:36 pm on Oct 9, 2013 (gmt 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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved