How do you write a code to pull data that is over a year old? (Comparing to 2 different date columns) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How do you write a code to pull data that is over a year old? (Comparing to 2 different date columns)

working on some code in Microsoft Access database 2013 and I am stumped on how to pull up records over a year old using 2 different date columns to generate a table of data with one or the other date being over a year old

24th Oct 2017, 8:29 PM
Eric Hudspeth
Eric Hudspeth - avatar
12 Answers
+ 30
select * from emp where year(date)>=year(curdate())-1; //hope it works☺
24th Oct 2017, 8:31 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 2
Select * from EMPLOYEE where JOINING_DATE >to_date('31/01/2013','dd/mm/yyyy' Select * from EMPLOYEE where JOINING_DATE <to_date('31/01/2013','dd/mm/yyyy' Hi Bro u have to mentioned date of joining . which DOJ u required
24th Oct 2017, 8:41 PM
Joseph Reddy Kambham
+ 1
I've been trying to use dateadd("yyyy",-1,Date()) I messed up tho with my question, it's more complicated than I made it seem. It's written like this where ((column A) like "Z*") and ((column b) is not null) and ((column c) is null) and [this is where I need to compare to see if column d or e are over 1 year old]
24th Oct 2017, 8:41 PM
Eric Hudspeth
Eric Hudspeth - avatar
+ 1
Plz try which sent
24th Oct 2017, 8:42 PM
Joseph Reddy Kambham
+ 1
I updated the question to be more specific on what I'm trying to do, sorry.
24th Oct 2017, 8:43 PM
Eric Hudspeth
Eric Hudspeth - avatar
+ 1
Bro you are awesome can you teach me please
25th Oct 2017, 2:30 PM
Abhishek Goud
+ 1
have u tried as per above
25th Oct 2017, 3:18 PM
Joseph Reddy Kambham
+ 1
no bro im a learner i know some basics but i want to know THE EXACT use of java
25th Oct 2017, 3:20 PM
Abhishek Goud
+ 1
I don't know about Java
25th Oct 2017, 3:24 PM
Joseph Reddy Kambham
+ 1
ohh that's okay
25th Oct 2017, 3:25 PM
Abhishek Goud
+ 1
Well, I got it to work thanks to Gaurav's answer, except I had to use Date() instead of curdate()
27th Oct 2017, 3:11 PM
Eric Hudspeth
Eric Hudspeth - avatar
0
try it
27th Oct 2017, 3:26 PM
Joseph Reddy Kambham