1.

SELECT pos_cashreceiptdetail.LocationCode,pos_cashreceiptpayment.TerminalCode,pos_cashreceiptpayment.ReceiptDate,
pos_cashreceiptdetail.Description,pos_cashreceiptpayment.ReceiptNo,SUM(TotalCost)
FROM pos_cashreceiptdetail,pos_cashreceiptpayment
WHERE pos_cashreceiptdetail.Description LIKE 'Raw%'
AND pos_cashreceiptdetail.LocationCode = pos_cashreceiptpayment.LocationCode
AND pos_cashreceiptdetail.ReceiptDate = pos_cashreceiptpayment.ReceiptDate
AND pos_cashreceiptdetail.ReceiptDate BETWEEN '2010-10-06' AND '2010-10-20'
GROUP BY pos_cashreceiptpayment.ReceiptDate,pos_cashreceiptdetail.ReceiptNo

2.

SELECT pos_cashreceiptdetail.LocationCode,pos_cashreceiptpayment.TerminalCode,pos_cashreceiptpayment.ReceiptDate,
pos_cashreceiptdetail.ShortDescription,pos_cashreceiptpayment.ReceiptNo,SUM(Totalprice)
FROM pos_cashreceiptdetail,pos_cashreceiptpayment
WHERE pos_cashreceiptdetail.ShortDescription LIKE 'Food Stall%'
AND pos_cashreceiptdetail.ReceiptDate = pos_cashreceiptpayment.ReceiptDate
AND pos_cashreceiptdetail.ReceiptNo = pos_cashreceiptpayment.ReceiptNo
AND pos_cashreceiptdetail.ReceiptDate BETWEEN '2010-10-06' AND '2010-10-20'
GROUP BY pos_cashreceiptpayment.ReceiptDate

This my problem. How to combine this query? This query come from one same existing table. Please help me then...

Thanks in advance yeah.. cheers

Hello,

One way to do it is to make the output column names the same in both queries and then use UNION to combine the two:

(Select xxxx as Field1, yyy as field2 ....
)
UNION
(Select zzz as Field1, ttt as field2 ....
)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.