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...
bake13
Jan 26, 2022Microsoft
Hi Alex_Kim245 --
Would you be able to paste the error message or screenshot of the error that you are receiving? I tested on SQL 2019 and am not encountering any errors. Take care.
Alex_Kim245
Jan 26, 2022Copper Contributor
I'm running it on Access and this is the query;
Select [table1].location
From (
Select [table1].vendor,
[table1].location,
rownum( ) over (partition by [table1].location order by [table1].vendor) as rownum
From [table1].vendor) [table1]
Where rownum = 1 and [table1].vendor = "HP"
Select [table1].location
From (
Select [table1].vendor,
[table1].location,
rownum( ) over (partition by [table1].location order by [table1].vendor) as rownum
From [table1].vendor) [table1]
Where rownum = 1 and [table1].vendor = "HP"
- Jonathan_AllenJan 31, 2022Brass Contributor
Alex_Kim245 try asking your question in the Access Community
- Alex_Kim245Jan 26, 2022Copper ContributorI see. Thanks for your help!
- bake13Jan 26, 2022Microsoft
Hi Alex_Kim245 --
That query will only work on SQL Server and is incompatible with Access. Unfortunately I do not know the Access-equivalent syntax and do not have Access available on which to test. Take care.