OT : help needed with a mySQL request

Peter Haworth pete at lcsql.com
Fri Nov 22 12:11:52 EST 2013


HI,
Interesting query! Something like this should do it.  I'm calling your
column with aaa,bbb,etc in ti "text" and this is from my SQLite knowledge
not mySQL so there might be syntax differences.

SELECT Text,Date FROM table GROUP BY Text HAVING Date='2013' AND
count(Text)=1 ORDER BY Text

Haven't tested it though.

Pete
lcSQL Software <http://www.lcsql.com>


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

> Hi Devin,
>
> Thanks for your reply. I'll try to make myself a bit more clear...
> Let's say I have the following table (2 columns, 4 entries) :
>   aaa 2004
>   aaa 2013
>   bbb 2013
>   ccc 2013
>
> I need to output with 1 single request entries bbb and ccc
> because they're the only ones that don't exist in the table
> with a date value other than 2013.
> Of course, I don't need to do that with 2013 only but with
> a wide range of dates from 1980 to 2013, but everytime
> the approach is the same with a specific year.
> Does it make more sense now ?
>
> Thanks.
> jbv
>
> >
> > On Nov 22, 2013, at 8: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
> >
> > I'm not exactly understanding what you're trying to do, but here are a
> > couple of things to keep in mind:
> >
> > - functions need to be embedded in the SELECT clause, not the WHERE
> > clause.
> >
> > - I have found that most MySQL interfaces require dates to be quotes;
> > e.g., WHERE date = '2013'.
> >
> > So a query like this should be legal (not tested):
> >
> > SELECT foo, bar, MIN(date) FROM myTable WHERE date < '2012'
> >
> > Again, I don't understand exactly what you want, but this might give you
> > some clues.
> >
> > Devin
> >
>
>
>
> _______________________________________________
> 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