OT : help needed with a mySQL request

Geoff Canyon gcanyon at gmail.com
Fri Nov 22 15:02:06 EST 2013


If I understand correctly (far from sure that I do) there are at least two
ways I can think of to do this. Either:

1. Find all rows where there is only one row with that particular set of
values in the other columns.
2. Find the results of (1) where the Date is in 2013

or

1. Find all the rows where the Date is 2013
2. Find the results of (1) where there is only one row with those values.

I think the latter might be more efficient, so if your date column is
myDate and the column with the other value is myLabel this should work:

select
    *
from
    myTable as T1
where
    myTable.myDate >= '2013-01-01'
and myTable.myDate < '2014-01-01'
and (select count(*) from myTable as T2 where T2.myLabel = T1.myLabel) = 1;




On Fri, Nov 22, 2013 at 9:47 AM, <jbv at souslelogo.com> wrote:

> Hi list,
>
> I have a table with a Date column (among others).
> Each entry has a date that ranges from 1930 to 2013.
> For several entries, the content of other columns can be similar,
> only the Date value changes. For instance I can have
>  aaa 2004
>  aaa 2013
> I need to find with 1 single request all entries with Date = 2013
> that don't exist in the table with other Date values.
> I tried SELECT * FROM myTable WHERE MIN(Date) = 2013
> but that returns an error #1111 - Invalid use of group function
>
> Any help would be much apreciated.
> Thanks in advance.
> jbv
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list