Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredJoin us at FabCon Vienna from September 15-18, 2025, for the ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM. Get registered
I have an A table in a warehouse. I want to query the table as follows:
Is it possible to query a subquery? How can I get distinct values and then get them as a string separated by ','?
Solved! Go to Solution.
Hi @amaaiia @can you try putting your select in a CTE:
;with distinctdata
as
(
select distinct field1 from [lakehouse].[schema].[table] where field2='value2'
)
select STRING_AGG(field1, ',') from distinctdata
Hi @amaaiia @can you try putting your select in a CTE:
;with distinctdata
as
(
select distinct field1 from [lakehouse].[schema].[table] where field2='value2'
)
select STRING_AGG(field1, ',') from distinctdata