I have 2 tables. TableA
is the sales and TableB
is the leads table. I'm trying to see if the people in the leads TableB
made a purchase and their name appears
on the sales TableA
. If they do I only want the name of people who appears
on both tables.
TableA (Sales)
customer school email address state phone Sales
john doe hight middle 111@hu.z 111 updown wi 2222222 $500
john doe hight middle 111@hu.z 111 updown wi 2222222 $100
zow hi hight middle 222@hop.c 111 updown wi 2222222 $200
calispo dwight elem s@dw.co.za 34 jimm elis CA 35450456 $1,000
Jordan clift high jp@hy.zut 1 unversity GA 11111111 $100
TableB (Leads)
customer school email address state
john doe hight middle 111@hu.z 111 updown wi
Kawi hight middle k@nop.c 111 updown wi
calispo dwight elem s@dw.co.za 34 jimm elis CA
What I want to see:
customer school email address state
john doe hight middle 111@hu.z 111 updown wi 2222222 $500
alispo dwight elem s@dw.co.za 34 jimm elis CA 35450456 $1,000
I try this query but it is returning duplicate of the info that I want
SELECT a.email as [sales_school]
,b.email[leadds_insti]
,a.*
,b.*
FROM [dbo].[Sales] a
right JOIN leads b ON a.email= b.email