This can be done using 3.23.49a, but it won't work, because the birthday year is somthing like 1981 and now() returns 2003. That is exactly the problem which I try to work out.
\Olaf
Peter Sap wrote:
Hi Olaf,
try something like this:
AND gebdatum between now() and date_add(now(),interval 7 day)
However, I have no idea if this can be done with 3.23.49a.
-- Peter Sap.
----- Original Message ----- From: "Olaf van Zandwijk" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, November 17, 2003 5:39 PM Subject: Birthday calendar
Hello,naam
I want to have a query that returns the names from people that are having their birthday one of the coming 7 days. I currently have a buggy query that deals with this, but that query fails when the birthday is the next month, and we're now in the last week of the month before.
Can anyone give me a hint in the right direction to do this? I'm using MySQL 3.23.49a, and it's not (yet) possible to use MySQL 4
Grtz, \Olaf
SELECT month(gebdatum) AS maand,
dayofmonth(gebdatum) AS dag,
achternaam,
CONCAT(roepnaam, ' ', COALESCE(tussenvoegsel, ' '), ' ', achternaam) AS
FROM persoon, WHERE YEAR(gebdatum) IS NOT NULL AND <This part of the query needs to be redone> AND CONCAT(roepnaam, ' ', COALESCE(tussenvoegsel, ' '), ' ', achternaam) IS NOT NULL ORDER BY maand, dag, achternaam
--
__XXX__
(0-0)
+--ooO--(_)--Ooo-------------------------------------------------------+
| |
| Olaf van Zandwijk |
| |
| ICQ# 30231605 |
| PGP Public Key: http://www.vanzandwijk.net/pgp.txt |
+----------------------------------------------------------------------+
-- __XXX__ (0-0) +--ooO--(_)--Ooo-------------------------------------------------------+ | | | Olaf van Zandwijk | | | | ICQ# 30231605 | | PGP Public Key: http://www.vanzandwijk.net/pgp.txt | +----------------------------------------------------------------------+