From: | "Booth, Robert" <Robert_Booth(at)intuit(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Access to Postgres query problem |
Date: | 2002-03-19 22:59:23 |
Message-ID: | 419D2EB7B461D411A53B00508B69181D0623228F@sdex02.sd.intuit.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I need to run a query in an Access client to my Postgres backend.
This is the query:
SELECT DISTINCT projectId, sum(billableHours), sum(billableHours *
billingRate)
FROM time_card_hours
GROUP BY projectId
When I run this in psql it says I need to cast to make the multiplication
work.
So I do this:
SELECT DISTINCT projectId, sum(billableHours), sum(billableHours *
cast(billingRate as double precision))
FROM time_card_hours
GROUP BY projectId
or:
SELECT DISTINCT projectId, sum(billableHours), sum(cast(billableHours as
numeric) * billingRate)
FROM time_card_hours
GROUP BY projectId
Both of which work fine, the first rounding and the second showing the
decimal places in the second sum.
Now to my question. When I do this from within Access it wants to use it's
own SUM and so it complains about the cast(). How can I either force Access
into sending the entire query to Postgres and just waiting for the
resultset, or force Access into performing the multiplication also?
Or my other thought is that I need to build my own operator/function to
handle the multiplying of double precision and numeric data types. If this
is what I should do how should I go about it?
Thanks,
Rob
From | Date | Subject | |
---|---|---|---|
Next Message | Jonathan Ellis | 2002-03-19 23:40:25 | Re: locking problems |
Previous Message | Peter Eisentraut | 2002-03-19 22:45:41 | Re: [SQL] How to create crude report with psql and/or plpgsql |