select product
,sum(case when client = 'ClientName1' then qt else null end) as clientname1
,sum(case when client = 'ClientName2' then qt else null end) as clientname2
from yourtable
group by product
order by 1

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

select Product,clientid,sum(qt) as qt
into #temp
from yourtable
where ...
group by product,clientid
Select client,identity(int,1,1) as rowno
into #temp1
from (
select distinct client
from #temp as t
) as x
declare @cid int
declare @sql varchar(8000)
set @cid = 1
set @sql='Select product'
while exists (select rowno from #temp1 where rowno=@cid)
do
select @SQL=@SQL+',SUm(Case when client='''+Client+''' then qt else null end) as ['+client+']'
,@cid=@rowno+1
from #temp1
Where rowno=@cid
end
Set @sql=@sql+',sum(qt) as [sum] from #temp group by product order by 1'
Exec(@SQL)

Featured Post

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library. Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…

Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…