Help - Search - Members - Calendar
Full Version: how to compare year using sql?
HTMLHelp Forums > Programming > Server-side Scripting
rrn
Hi all ,

in my database there are rows of date in the form dd-mm-yyyy
wat i want to do is?
i want to leave a space after different years..ie
if the table is
22-09-2004
06-06-2004
25-12-2005
03-02-2005
17-02-2008

it should be like this

22-09-2004
06-06-2004

25-12-2005
03-02-2005

17-02-2008

how will i compare the years using php code??
Brian Chandler
QUOTE(rrn @ May 10 2009, 10:16 PM) *

Hi all ,

in my database there are rows of date in the form dd-mm-yyyy
wat i want to do is?
i want to leave a space after different years..ie
if the table is
22-09-2004
06-06-2004
25-12-2005
03-02-2005
17-02-2008

it should be like this

22-09-2004
06-06-2004

25-12-2005
03-02-2005

17-02-2008

how will i compare the years using php code??


You asked this before. The answer is the same. Where is the script you have at present?

(Quoting me...)
In this script that I can't see, there must be some kind of loop. Have a variable with the year from the previous record; compare with the year from the current record; if different, the year has "changed". If you have written the loop to do this, it is beyond me to understand how you can't see how to do this.

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.