Forum Discussion
Alex_Kim245
Jan 25, 2022Copper Contributor
Sql query
Could someone help me construct query to find location that only has HP in below table; vendor location HP TX Cisco TX Dell TX HP CA HP WA Dell WA HP OR Cisco O...
Alex_Kim245
Jan 26, 2022Copper Contributor
This will not work because TX has Cisco and Dell also. I'm trying to get the ones that only have HP.
bake13
Microsoft
Jan 26, 2022Hi Alex_Kim245 --
Apologies, I misunderstood. Something like the query below might work. Take care.
SELECT *
FROM (
SELECT
Vendor
,VendorLocation
,row_number() over (partition by VendorLocation order by Vendor) as rownum
FROM
Vendor
) t
WHERE
rownum = 1
AND
Vendor = 'HP'
- Alex_Kim245Jan 26, 2022Copper ContributorGetting syntax error in From clause.
- bake13Jan 26, 2022
Microsoft
- Alex_Kim245Jan 26, 2022Copper Contributorthis section right here;
FROM
Vendor
) t
table name is table1 so Vendor should be table1? and what is t?