[prev in list] [next in list] [prev in thread] [next in thread]
List: mysql
Subject: Re: Limiting "DISTINCT" To One Column
From: Hank <heskin () gmail ! com>
Date: 2005-09-29 16:48:43
Message-ID: 1990a96b05092909483354b61a () mail ! gmail ! com
[Download RAW message or body]
To check for more than one channel-per-record in the table:
select channel,count(*) as cnt from ChannelStatus group by channel having cnt>1
should return zero records if you have no dups.
On 9/29/05, Hal Vaughan <hal@thresholddigital.com> wrote:
> I have a query like this:
>
> SELECT DISTINCT Channel, ChannelType, Source FROM ChannelStatus;
>
> Each channel is supposedly listed in this table only 1 time, but just in case,
> what I really want to do is make sure that no channels are duplicated. Is
> there some way to make the keyword "DISTINCT" apply to Channel only? Sort of
> a shortcut to (example in pseudocode, although it'd be in Perl):
>
> SELECT DISTINCT Channel FROM ChannelStatus;
> FOR EACH Channel
> SELECT Channel, ChannelType FROM Source WHERE Channel = 'channel'
> ENDLOOP
>
> Thanks!
>
> Hal
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql?unsub=heskin@gmail.com
>
>
--
-Hank
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=mysql@progressive-comp.com
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic