-1

I have data in columns from 2 separate tables I'm looking to match up and analyze the output, but I'm a complete noob so I'm not sure how to write it. I've searched the results here but I guess I'm not understanding the answers

So If you don't mind helping, here's what I can do so far. The ItemID is the same for each item

SELECT ItemID, Title FROM Listings 
SELECT ItemID, SKU FROM Inventory

I tried plugging in UNION between the statement but I get error;

Cannot resolve the collation conflict between "Latin1_General_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the UNION operation.

Thanks in advance

S3S
  • 24,809
  • 5
  • 26
  • 45
Chuck
  • 3
  • 2
  • Possible duplicate of [SQL join: where clause vs. on clause](http://stackoverflow.com/questions/354070/sql-join-where-clause-vs-on-clause) – a coder Apr 04 '17 at 20:15

2 Answers2

2

You need to use join, like this:

SELECT a.ItemID, a.Title, b.ItemID, b.SKU
FROM Listings as a inner join Inventory as b on (a.ItemID = b.ItemID)
Iłya Bursov
  • 23,342
  • 4
  • 33
  • 57
1

You want an inner join between the two tables. Try something like

SELECT Listings.ItemID, Listings.Title, Inventory.ItemID, Inventory.SKU
FROM Listings
INNER JOIN Inventory ON Listings.itemId = Inventory.itemId;
Tre
  • 34
  • 3