[NBLUG/talk] OT - SQL query question
Mark Street
mark at oswizards.com
Fri Dec 2 10:55:30 PST 2005
On Friday 02 December 2005 11:26 am, Scott Doty wrote:
> I may be wrong, but I think you can just list the other fields that you
> want...e.g.: select distinct(ADDR1),field2,field3 from mydb ...
Thanks Scott,
I already tried that, but DISTINCT seems to be ignored in that SQL statement.
On Friday 02 December 2005 11:31 am, Eric Eisenhart wrote:
> So, let's say your table looks like this:
> ---+------+-------+-------+
> ID | NAME | ADDR1 | ADDR2 |
> ---+------+-------+-------+
> 1 | Bob | 1234 | St. |
> 2 | Sue | 1234 | St. |
> 3 | Sue | 1234 | Ave. |
> 4 | Joe | 7689 | Wy. |
> ---+------+-------+-------+
> your query, of course, returns: 1234 and 7689 (with no connection to
> anything else). When you say you "need the other fields", what should you
> get back in this case?
I would want the NAME and ADDR2, etc. fields as well as the DISTINCT field.
Actually my ADDR1 field contains the street number and name, not a biggie. I
guess #2 below would come closest to my requirements.
> this:
> Bob | 1234 | St.
> Sue | 1234 | St.
> Sue | 1234 | Ave.
> Joe | 7689 | Wy.
> or this:
> 1234 | St.
> 1234 | Ave.
> 7689 | Wy.
> or this:
> 1234 | St.
> 7689 | Wy.
--
Mark Street, RHCE
http://www.oswizards.com
--
Key fingerprint = 3949 39E4 6317 7C3C 023E 2B1F 6FB3 06E7 D109 56C0
GPG key http://www.oswizards.com/pubkey.asc
More information about the talk
mailing list