Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date/ time function

Status
Not open for further replies.

vz

MIS
Jul 31, 2001
131
0
0
US
I have an postgresql db linked to access and one of my access queries don't work. it uses the datediff function in access and the month and year functions and i wa swondering how if anyone knew how to get this to work in postgresql. here is the code that works in access but not access with postgresql.

INSERT INTO [tblBranch Problem History] ( branch, problem_code, year, month, CountOfhuman )
SELECT DISTINCTROW [tblproblems archive].branch, [tblproblems archive].problem_code, Year([problem date]) AS Year, Month([problem date]) AS month, Count([tblproblems archive].human) AS CountOfhuman
FROM [tblproblems archive]
WHERE (((DateDiff("m",[problem date],[Enter Beginning Date]))=0) AND ((DateDiff("yyyy",[problem date],[Enter Beginning Date]))=0))
GROUP BY [tblproblems archive].branch, [tblproblems archive].problem_code, Year([problem date]), Month([problem date])
HAVING ((([tblproblems archive].branch) Is Not Null));
When I take out the month and date diff lines it doesn't blow up butI don't get what I need.
Thanks in advance!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top