Page 1 of 1

How can I prevent multiple outputs from a query?

Posted: Thu Dec 16, 2010 3:58 am
by dominod
Hi there 8)

Im just wondering how I can prevent the query from outputing the same name twice in a query?

Example:

If I query and it outputs:

Name- Age- Location-
Roger 23 New York
Eric 29 Miami
Eric 48 Boston

Is there a way to make it recognize that it already outputed "Eric" then make it skip the next eric so it just outputs:

Name- Age- Location-
Roger 23 New York
Eric 29 Miami

?

Thanks alot guys :)

Re: How can I prevent multiple outputs from a query?

Posted: Thu Dec 16, 2010 5:26 am
by VladSun
First question - how do you decide which data should come out with Eric? I.e. why it is "29 Miami" and not "48 Boston"?

Re: How can I prevent multiple outputs from a query?

Posted: Thu Dec 16, 2010 6:28 am
by dominod
Because there is one row which sais:

Eric 29 Miami

while another row sais:

Eric 48 Boston

Re: How can I prevent multiple outputs from a query?

Posted: Thu Dec 16, 2010 6:31 am
by dominod
Solved it:

Code: Select all

(...) GROUP BY name