SQLTeam.com | Weblogs | Forums

One sale trx have entitle offer 2 package discount promotion


#1

Dear Sir , how to edit this query for after result ?

Before : -
Item code discount Discount name
4895177031614 AYC'17-PA CLEARANCE SALE
4895177031614 GET10%DISCO AYC'17-BUY 3 OR MORE GET 10% EXTRA
4895177031560 AYC'17-PA CLEARANCE SALE
4895177031560 GET10%DISCO AYC'17-BUY 3 OR MORE GET 10% EXTRA
4895177033618 GET10%DISCO AYC'17-BUY 3 OR MORE GET 10% EXTRA
4895177033618 AYC'17-PA CLEARANCE SALE

After : it show each item have entitle two discount offer. (No duplicate item code).
4895177031614 GET10%DISCO AYC'17-BUY 3 OR MORE GET 10% EXTRA & AYC'17-PA CLEARANCE SALE
4895177031560 GET10%DISCO AYC'17-BUY 3 OR MORE GET 10% EXTRA & AYC'17-PA CLEARANCE SALE
4895177033618 GET10%DISCO AYC'17-BUY 3 OR MORE GET 10% EXTRA & AYC'17-PA CLEARANCE SALE
------------------------------------------------------------------------------------------------------ my query
SELECT
itembarcode,
discountcode,
discountname
FROM
DW_PURE01.dbo.AX_DailySales_v1_2
WHERE
transactionid='0000000084' and SaleDate = '2017-06-08'

         and ReceiptID like 'HK027T10117100042' 

Regards,
Felix


#2

Please post SQL code: create table(s) or declare table variables and inserts with sample data. Thanks for including what you tried. If you're just wanting to remove new lines you can use the replace function.