public inbox for [email protected]
help / color / mirror / Atom feedRe: Hi
2+ messages / 2 participants
[nested] [flat]
* Re: Hi
@ 2017-08-25 06:49 Daulat Ram <[email protected]>
2017-08-25 14:42 ` Re: Hi David G. Johnston <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Daulat Ram @ 2017-08-25 06:49 UTC (permalink / raw)
To: pgsql-performance
Hello,
Would I request to help me on this query.
SELECT 'Inspection Completed' as "ALL Status" ,COUNT(*) as "Number of Count" FROM ud_document WHERE status = 'Inspection Completed' union SELECT 'Pending', COUNT(*) FROM ud_document WHERE status = 'Pending' union SELECT 'Approved', COUNT(*) FROM ud_document WHERE status = 'Approved' union SELECT 'Rejected', COUNT(*) FROM ud_document WHERE status = 'Rejected' union SELECT 'Payment Due',count(*) from ud_document where payment_status = 'Payment Due' union SELECT 'Payment Done' ,count(*) from ud_document where payment_status = 'Payment Done'
And now I want to exclude the uniqueid= '201708141701018' from the above query. how it can be ???
Regards,
Daulat
________________________________
DISCLAIMER:
This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. Check all attachments for viruses before opening them. All views or opinions presented in this e-mail are those of the author and may not reflect the opinion of Cyient or those of our affiliates.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Hi
2017-08-25 06:49 Re: Hi Daulat Ram <[email protected]>
@ 2017-08-25 14:42 ` David G. Johnston <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: David G. Johnston @ 2017-08-25 14:42 UTC (permalink / raw)
To: Daulat Ram <[email protected]>; +Cc: pgsql-performance
On Thu, Aug 24, 2017 at 11:49 PM, Daulat Ram <[email protected]> wrote:
> Hello,
>
>
>
> Would I request to help me on this query.
>
>
>
> SELECT 'Inspection Completed' as "ALL Status" ,COUNT(*) as "Number of
> Count" FROM ud_document WHERE status = 'Inspection Completed' union SELECT
> 'Pending', COUNT(*) FROM ud_document WHERE status = 'Pending' union SELECT
> 'Approved', COUNT(*) FROM ud_document WHERE status = 'Approved' union
> SELECT 'Rejected', COUNT(*) FROM ud_document WHERE status = 'Rejected'
> union SELECT 'Payment Due',count(*) from ud_document where payment_status =
> 'Payment Due' union SELECT 'Payment Done' ,count(*) from ud_document where
> payment_status = 'Payment Done'
>
>
>
> And now I want to exclude the uniqueid= '201708141701018' from the above
> query. how it can be ???
>
>
>
Your use of UNION here seems necessary. Just write a normal GROUP BY
aggregation query. You might need to get a bit creative since you are
collapsing status and payment_status into a single column. "CASE ... WHEN
... THEN ... ELSE ... END" is quite helpful for doing stuff like that. For
now I'll just leave them as two columns.
SELECT status, payment_status, count(*)
FROM ud_document
WHERE uniqueid <> '201708141701018'
GROUP BY 1, 2;
David J.
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2017-08-25 14:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-08-25 06:49 Re: Hi Daulat Ram <[email protected]>
2017-08-25 14:42 ` David G. Johnston <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox