Regd Merging These 2 MySql Queries into 1
Paaro <[email protected]> Sat, 9 Apr 2022 06:45:56 -0700 (PDT)
| Newsgroups | alt.comp.databases.mysql |
|---|---|
| Message-ID | <[email protected]> |
I have following two SQL queries to execute in mySQL. SELECT total(amount) as total_receipts FROM receipts WHERE torderid = 101 SELECT total(amount) as total_refunds FROM refunds WHERE torderid = 101 I get following below values using these two above queries total_receipts total_refunds Now I need to calculate net_receipts as below. net_receipts = total_receipts - total_refunds Is there way to get total_receipts, total_refunds and net_receipts by merging the above two queries into a single SQL query? Please help.