Welcome Guest, Not a member yet? Register   Sign In
how to write query for combining dates
#1

[eluser]Bigil Michael[/eluser]

Here i would like to calculate the experience. table structure shown below

id candidate_id startdate enddate

1 1000 2001-01-01 2001-12-31

2 1000 2002- 01-01 2004- 11- 20

3 1000 2004-11-25 2010-12-31

my query is like this

Code:
$this->db->where('DATEDIFF(end_date, start_date) >=',  365);
$this->db->group_by('candidate_id');

here 365 is a demo value

it run successfully if i search for 1 year, 2 year ...

but if i search for 8 or 9 years no result is the answer.

can any one help me to combine these dates according to the cndidate_id.

thanks.....




Theme © iAndrew 2016 - Forum software by © MyBB