Skip to content

Instantly share code, notes, and snippets.

@riccardopirani
Created December 12, 2017 09:27
Show Gist options
  • Save riccardopirani/64489fa4500211fcc362c85e77783f62 to your computer and use it in GitHub Desktop.
Save riccardopirani/64489fa4500211fcc362c85e77783f62 to your computer and use it in GitHub Desktop.
Order by error on Sql Server
SET LANGUAGE 'Italian' select Tipo, Data , GG, CodArt as 'CodArt',Descrizione,Quantita as 'Quantita',Prezzo,Totale from (
Select 'R' as Tipo, CONVERT(VARCHAR(10), RisorseUmane.Data, 105) as Data, DATENAME(WEEKDAY, RisorseUmane.Data) as GG, 'Utente' as CodArt, RisorseUmane.Descrizione, PARSE(REPLACE(convert(varchar(5), Cast(convert(varchar(5), (OreFine - OreInizio), 108) as datetime) - CAST(REPLACE(Pausa, '.', ':') as datetime), 108),':',',') as money) as Quantita, Utente.CostoInterno as Prezzo, (Utente.CostoInterno* Replace(convert(varchar(5), Cast(convert(varchar(5), (OreFine - OreInizio), 108) as datetime) - CAST(REPLACE(Pausa, '.', ':') as datetime), 108),':', ',')/100) as Totale from RisorseUmane inner join Utente on RisorseUmane.IdUtente = Utente.IdUtente where IdCantiere = '131'
/*.....*/
)Q
ORDER BY Data ASC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment