The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> how to compare year using sql?
rrn
post May 10 2009, 08:16 AM
Post #1


Novice
**

Group: Members
Posts: 21
Joined: 15-April 09
Member No.: 8,330



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??
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post May 10 2009, 08:29 AM
Post #2


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



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.

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 29th March 2024 - 11:03 AM