-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wednesday 04 February 2004 16:03, mos wrote:
> At 09:35 AM 2/4/2004, John Croson wrote:
> >I have a simple query:
> >
> >SELECT id,year,month,day,cat_id FROM events
> >LEFT JOIN calendar_cat ON
> >events.cat=calendar_cat.cat_id
> >WHERE year>=YEAR(CURDATE())
> >AND month>=MONTH(CURDATE())
> >AND day>=DAYOFMONTH(CURDATE())
> >AND cat_id='2' OR cat_id='5'
> >AND approved='1'
> >ORDER BY year,month,day ASC

My server is down right now, but I believe your problem is in the "OR" 
conditional. Without parenthesis to separate your conditions, the query seems 
to be asking for a condition that the cat_id is '2' and the stored date is 
greater than or equal to the current date *OR* the cat_id is '5' and the 
approved flag is '1'. I'm betting that if you look at the first item, the 
approved flag is equal to '1'.

You might want to try "AND (cat_id='2' or cat_id='5')"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)

iD8DBQFAIW8cjeziQOokQnARAiY/AJ9G4qaGLioww3vJ5PfYPN2KOSUdWQCcDac0
29vkek0CgRQM74b1nabARHM=
=mfhb
-----END PGP SIGNATURE-----


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to