Postgresql Date from Timestamp to String in Java -
i getting timestamp date postgres database format of yyyy-mm-dd. problem have table entries between 2 dates, date format not have between operator.
select jiraissue.project projectid, project.pname, coalesce(sum(worklog.timeworked),0) timeworked jiraissue, worklog, project jiraissue.project = 11350 , jiraissue.id = worklog.issueid , jiraissue.project = project.id , date(worklog.updated) between 2015-09-16 , 2015-09-30 group timeworked, project, project.id
now postgres wants explicit cast, string, to_char in front if date wo't work either. me?
this should trick:
select jiraissue.project projectid, project.pname, coalesce(sum(worklog.timeworked),0) timeworked jiraissue, worklog, project jiraissue.project = 11350 , jiraissue.id = worklog.issueid , jiraissue.project = project.id , date(worklog.updated) >= '2015-09-16'::date , date(worklog.updated) <= '2015-09-30'::date group timeworked, project, project.id
assuming you're on recent stable version (9.4), this section of documentation covers topic of date/time handling. might want check sql expressions type casting, ::
bit in solution.
Comments
Post a Comment