MYSQL . Query select

danz67
danz67 used Ask the Experts™
on
hi,
I would like to change this query,
I need to see the DESCRIZIONE field that is in the ARTICOLI table

SELECT A.IDARTICOLO,
       A.TAGLIA,
       A.COLORE,
       A.QUANTITA
FROM CARICOTCDOC  A
LEFT OUTER JOIN VENDUTI B ON A.IDARTICOLO  = B.IDARTICOLO
WHERE B.IDARTICOLO IS NULL

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
SELECT A.IDARTICOLO,
       A.TAGLIA,
       A.COLORE,
       A.QUANTITA,
AR.DESCRIZIONE
FROM CARICOTCDOC  A
Inner join ARTICOLI AR ON Ar.IDARTICOLO = A.IDARTICOLO
LEFT OUTER JOIN VENDUTI B ON A.IDARTICOLO  = B.IDARTICOLO
WHERE B.IDARTICOLO IS NULL

Author

Commented:
pratima_mcs:

works well, I would avoid repeating data, perhaps we need a grouping?
Kevin CrossChief Technology Officer
Most Valuable Expert 2011

Commented:
If the data was not repeating before pratima_mcs's suggestion that simply means you need to find a more unique JOIN criteria to ARTICOLI.  What column(s) in that table uniquely match it to a row in CARICOTCDOC?  If the data was repeating before, then you may be able to use GROUP BY or SELECT DISTINCT.  With the former, you will need to determine what to do with other values, i.e., how to aggregate them.  It is always best to find why rows are duplicated in the first place to avoid unnecessary GROUP BY/DISTINCT usage.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial