Stevie Zakhour
asked on
MySQL - Script - Creating Duplicates Despite Using Distinct Function
Hi All
I built the below script in MySQL Version 5.5
The output is great, however despite using the distinct function I still end up with duplicate entries, for example (duplicate in bold)
How do I tackle the duplicates? I know this can be done in Excel but since I'm saving the script in MySQL as a view. Any help is greatly appreciated!
I built the below script in MySQL Version 5.5
use airrider_tunn3l;
select distinct
b.customer_name as 'Flyer Name'
,FROM_UNIXTIME(b.timeslot) as 'Flight Date and Time'
,i.num as 'Invoice Number'
,b.voucher_title as 'Product'
,b.minutes as 'Flight Minutes'
,b.origin_nb_flights as 'Flight Quantity'
,b.customer_num as 'Guest Number'
,i.paid_ttc as 'Gross'
,i.total_ht as 'Net'
,i.total_tva as 'Tax'
,i.payment_method as 'Pay Method'
,FROM_UNIXTIME(b.checkin) as 'Check In'
FROM booking b
join invoices i on i.id = b.invoice_id
order by b.customer_name, b.timeslot, i.num, b.voucher_title, b.minutes, bb.origin_nb_flights,
b.customer_num, i.paid_ttc, i.total_ht, i.total_tva, i.payment_method, b.checkin asc
The output is great, however despite using the distinct function I still end up with duplicate entries, for example (duplicate in bold)
Customer Name Flight Date and Time Invoice Number Product Flight Minutes Flight Quantity Gueest Number Gross Net Tax Pay Method Check In
Test Test Test 1/21/18 01:30 PM 00000228 Kids Party Extra Flyer 1.9 2 18000182 1498 1413.21 84.79 paymentexpress 1/21/18 01:44 PM
[b]Test Test Test 1/21/18 01:30 PM 00000228 Kids Party Extra Flyer 1.9 2 18000182 1498 1413.21 84.79 paymentexpress 1/21/18 01:44 PM[/b]
How do I tackle the duplicates? I know this can be done in Excel but since I'm saving the script in MySQL as a view. Any help is greatly appreciated!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER