Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9136917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:01:05+00:00 2026-06-17T09:01:05+00:00

I have this problem. I have an sql query am trying to make to

  • 0

I have this problem. I have an sql query am trying to make to my postgres db. These queries work fine in oracle but am in the process of converting it to a postgres query but it complains. This is the query:

select  to_char(calldate,'Day') as Day, date_trunc(calldate) as transdate,
Onnet' as destination,ceil(sum(callduration::integer/60) )as    total_minutes,round(sum(alltaxcost::integer) ,2)as revenue
from cdr_data 
where callclass ='008' and callsubclass='001'
and callduration::integer >0
and  regexp_like(identifiant,'^73')
and bundleunits = 'Money'
and inserviceresultindicator in (0,5)
and regexp_like(regexp_replace(callednumber,'^256','') ,'^73')
group by  to_char(calldate,'Day') ,trunc(calldate),'Onnet' order by 2

And the error am getting is this:

Err] ERROR:  function date_trunc(timestamp without time zone) does not exist
LINE 4: select  to_char(calldate,'Day') as Day, date_trunc(calldate)...

What am I doing wrong, or what is the solution to this error?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:01:06+00:00Added an answer on June 17, 2026 at 9:01 am

    Try:

    ... date_trunc('day',calldate) ...
    

    For PostgreSQL date_trunc() function you must always specify precision as the first argument.

    Details here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're currently stuck trying to make a simple (?) SQL query. We have these
I'm getting crazy with this problem: I have got some Oracle SQL-Reports to redesign
I have 5 tables in MySQL, but i believe this is a SQL problem
I have a classified site... I'm trying to make a sql query that COUNTS
I have this SQL query in Access, which works fine: SELECT TableA.FieldA As [Code],
I'm a beginner at SQL and have this fairly easy conditional problem: Every installation
I'm having trouble trying to define the SQL query for this table: There's a
I've been trying to construct a sql query with ZendFW, but I cant seem
I am trying to write a sql query but i find some difficulties.What i
Hi guys I have this SQL query (MSSQL), I'm doing a query where the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.