MySQL Forums
Forum List  »  Stored Procedures

Re: Fetching Records...
Posted by: John Noble
Date: May 11, 2021 03:16AM

Sorry....

SELECT
salesHistoryArchive.customerID,
customers.name as customerName,
salesHistoryArchive.despatchDate,
salesHistoryArchive.invNum,
salesHistoryArchive.productID,
products.description as productDescription,
CASE WHEN notr = "10" THEN salesHistoryArchive.quantityDespatched ELSE salesHistoryArchive.quantityDespatched *-1 END as quantity,
CASE WHEN notr = "10" THEN salesHistoryArchive.lineWeight ELSE salesHistoryArchive.lineWeight * -1 END as lineWeight,
salesHistoryArchive.price,
CASE WHEN notr = "10" THEN salesHistoryArchive.lineValue - salesHistoryArchive.discountValue - salesHistoryArchive.discount2Value ELSE (salesHistoryArchive.lineValue - salesHistoryArchive.discountValue - salesHistoryArchive.discount2Value) * -1 END as lineValue
FROM
salesHistoryArchive
INNER JOIN customers ON customers.customerID = salesHistoryArchive.customerID
INNER JOIN products ON products.productID = salesHistoryArchive.productID
WHERE
notr = "10" AND
salesHistoryArchive.MSCFlag = "T" AND
despatchDate BETWEEN p_fromDate AND p_toDate AND
salesHistoryArchive.transactionType <> "WL"

Thanks,

John

Options: ReplyQuote


Subject
Views
Written By
Posted
629
May 10, 2021 06:39AM
229
May 10, 2021 10:19AM
Re: Fetching Records...
222
May 11, 2021 03:16AM
276
May 11, 2021 02:18PM
190
May 12, 2021 03:47AM
251
May 12, 2021 09:43AM
186
May 13, 2021 05:20AM
221
May 13, 2021 09:13AM
214
May 14, 2021 02:21AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.