Hi,

I have a calendar table that has event comments and a date tagged to it.

I would like to view "Upcoming Events" only.

I was wondering what type of syntax I'll need to be using?


heres how the table would look:

comment | d1 | d2 | d3
----------------------------
bobs bday....11....18... 2006
my bday .... 8....30... 2006
erics bday... 9.... 29... 2006
----------------------------

SELECT comment FROM calendar where CURRENT_DATE() < 'd1-d2-d3'

Thats my guessing...I tried looking for places to see what correct syntax to use but im just still lost. I work with sql a lot but never really syntax that compares dates and time.

Thanks,
Bobby

You're close but consult the MySQL (I'm assuming that's your db) documentation for the correct timecode format. I think its YYYYMMDDHHMMSS (and you may insert 0s wherever you want.) so:

SELECT comment FROM calendar WHERE CURRENT_DATE() < 'd3d2d1000000';

If that single quoted string is a valid way to truncate variables and additional strings in SQL ( I don't remember sorry)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.