I am trying to to remove the duplicated from my SQL statement Customer id ,firstname and lastName I want to be able group by customerID and Remove the duplicated Customer id form,firstname and lastName From Final output
SELECT customers.customerid,
customers.title,
customers.firstname,
customers.lastname,
customers.postion,
company.companyname,
(SELECT label.labelcontacttype
FROM label
WHERE label.labelcontacttypeid =
customer_contacts.labelcontacttypeid)AS
contactType,
customer_contacts.contactdetails,
customer_contacts.status,
customer_contacts.notes
FROM customers
INNER JOIN customer_company
ON customers.customerid = customer_company.customerid
INNER JOIN company
ON customer_company.companyid = company.companyid
INNER JOIN customer_contacts
ON customers.customerid = customer_contacts.customerid
Current output
15 Mr Mike Smith Web Developer compudata Email email@email.com 1 dvv
15 Mr Mike Smith Web Developer compudata Phone 111-111-1111 1 ex:2222
It is really not very clear what you are trying to do, but if you only want the customerid, title, firstname and lastname to appear once, then you can use: