cosmicsnake Posted October 29, 2014 Share Posted October 29, 2014 (edited) Hi, I have this query with cte (Dia,Cliente,Estab,Nome,Maquina)as(select (case when dia in(1,8,15,22) then '2ª Feira' when dia in(2,9,16,23) then '3ª Feira' when dia in(3,10,17,24) then '4ª Feira' when dia in(4,11,18,25) then '5ª Feira' when dia in(5,12,19,26) then '6ª Feira' when dia in(6,13,20,27) then 'Sabado' when dia in(7,14,21,28) then 'Domingo' else '' end) as dia,rotl.Cli_Cod,rotl.Cli_Estab,cli.nome,isnull(maq.cod,0)as Maquina from RotCinner join rotd on RotD.RotC_Id=rotc.idinner join rotl on rotl.RotD_ID=rotd.idinner join cli on cli.cod=RotL.Cli_Cod and cli.Estab=rotl.Cli_Estableft join maq on maq.Cli_Cod=cli.cod and cli.estab=maq.Cli_Estabwhere rotc.Vnd_Cod=28and rotc.Ativa=1and maq.Ativa=1group by rotd.Dia,rotl.Cli_Cod,rotl.Cli_Estab,cli.nome,maq.cod)select dia,maquinafrom cte And i have this result: But i want this: How can i resolve my problem? Regards Edited October 29, 2014 by cosmicsnake Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now