Josuelito

Membros
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

0 Neutro

About Josuelito

  1. select count(*) as quant, faixa_salarial from tabela group by faixa_salarial
  2. create table vdpro (item varchar(20), codlinha int) insert vdpro (item,codlinha) values ('item 1',20),('item 2',20),('item 3',20),('item 4',20),('item 5',30),('item 10',40) declare @vendas as table (venda varchar(15),codlinha int); with cte_vendas (codlinha) as ( select codlinha from vdpro group by codlinha ) insert @vendas(venda,codlinha) SELECT concat('vendas ',ROW_NUMBER() OVER (ORDER BY a.codlinha)) AS venda, a.codlinha from cte_vendas as a select venda, item, a.codlinha from @vendas a join vdpro b on a.codlinha = b.codlinha
  3. em desenvol tente into é feio... mas funciona --sql2012 ou superior Update [dbo].[ItemExtraFields] SET [TextAnswer]=concat(substring([Description],1, charindex(' ', [Description])) , substring([Description],cast(charindex(' ', [Description])+1 as int)+cast(charindex(' ', substring([Description],cast(charindex(' ', [Description])+1 as int),len([Description]))) as int),len([Description]))) FROM [dbo].[ItemExtraFields] a INNER JOIN [dbo].[ItemNames] b on a.[ItemID]=b.[ItemID] --sql2008 ou anterior Update [dbo].[ItemExtraFields] SET [TextAnswer]=substring([Description],1, charindex(' ', [Description])) + substring([Description],cast(charindex(' ', [Description])+1 as int)+cast(charindex(' ', substring([Description],cast(charindex(' ', [Description])+1 as int),len([Description]))) as int),len([Description])) FROM [dbo].[ItemExtraFields] a INNER JOIN [dbo].[ItemNames] b on a.[ItemID]=b.[ItemID]