Welcome Guest, Not a member yet? Register   Sign In
Help with query structure, upcoming events and birthdays (two separate tables)
#13

[eluser]JamieBarton[/eluser]
Ignore that, it was because of the single quotes.

I replaced all of that and now get the following

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

(SELECT id as id, start_time as date, title as name, '' as last_name, 'event' as type FROM events WHERE family_id = 1 AND start_time BETWEEN NOW() AND DATE_ADD(NOW(), INTERVAL 1 WEEK)) UNION (SELECT user_id as id, birth_date as date, first_name as name, last_name as last_name, 'birthday' as type FROM users WHERE family_id = 1 AND DATE_FORMAT(birth_date, '%m%d') BETWEEN DATE_FORMAT(NOW(), '%m%d') AND DATE_FORMAT(DATE_ADD(NOW(), INTERVAL 1 WEEK), '%m%d') ORDER BY date LIMIT 5


Messages In This Thread
Help with query structure, upcoming events and birthdays (two separate tables) - by El Forum - 02-21-2010, 02:26 PM



Theme © iAndrew 2016 - Forum software by © MyBB