sql server - SQL query error with variable -


This query is trying to run, but its return errors:

  Array ([0] = & gt; Array ([0] => 42000 [SQLSTATE] => 42000 [1] = & gt; 156 [code] => 156 [2] = & gt; [Microsoft] [SQL Server Native Client 11.0] [SQL Server] 'End' has the wrong syntax. [Messaging] => [Microsoft] [SQL Server Native Client 11.0] [SQL Server] The keyword 'end' is wrong with Syntax.))   

SQL query:

  Select routines.date, routines.time, SUM (case when measurements.title = 'T_Luft_Temperatur' then CAST (REPLACE (routines.value, ',', '.') To decimal (18, 2)) and zero end ) Temperatur, SUM (case when measurements.title = 'T_Badende_per_Time' as cast (routines.value REPLACE (, ',', '.') As decimal (18, 2)) and zero Badende_Per_Time, SUM (The case is when measurements.title = 'T_Luft_Temperatur' as artists (in the form of routines.value REPLACE (, ',', '.') As decimal (18, 2)) and zero end ) As Luft_Temperatur, Sam (CA SE) when measurements.title = 'M_Fritt_Klor' then cast (, REPLACE (routines.value ',', ' . ') As a decimal (18, 2) and zero end), in the form of the case FrittKlor, SUM (when the measurements.title =' M_Bundet_Klor 'then cast (REPLACE (routines.value,', ',' ') As a decimal (18, 2) and zero end) BundetKlor, SUM (case is when' measurements.title = 'as' M_Total_Klor' then cast (REPLACE (as, ',', '.' ) As a DCIMAL (18, 2)) ELSE tap END) Total cloor, SM (case when measurements.title = 'M_PH' then cast (again (routines.value, ',', '.') AC DCIMAL (18 (2)) ASH, SUM (In case of measurement. Titli = 'M_Ato_Clore' then cast (re-price (routine value, ',', '.') As DCIML (18, 2)) ASLL and ASTCellar, SU (Case, measure, ',', '.') AC DCIML (18,2) ALSE NULL END) ''. $ 'Between FraDato' and 'Auto' ''. $ '' And ''. $ '' And 'pools.name =' ". $ In the form of autof and routines between basseng." And between routine "$. $ FraTid." ' And ''. $ TilTid. '' Join routine from routine routines.id = measure_routine.routine_id on the inside measure_routine.measure_id = measurements.id interi routines.date by measure_routine.pool_id = pools.id group pool included measurement Which routine. Time commands by routines.date, routines.time;    

  select routines.date, routines.time, SUM (case When the measurements .title = 'T_Luft_Temperatur' then cast (REPLACE (routines.value, ',', '.') As decimal (18, 2)) and zero end) Temperatur, SUM (case as when the measurements. title = 'T_Badende_per_Time' then cast (, REPLACE (routines.value ',', '.') as decimal (18, 2) and zero end) Badende_Per_Time, SUM (case when measurements.title = 'T_Luft_Temperatur 'Then the cast (in the form of REPLACE (routines.value,', ','. '), Decimal (18, 2)) and zero end) Luft_Temperatur, SUM (case when measurements.title =' M_Fritt_Klor 'then cast ( REPLACE (routin As the 'FrittKlor', the SUM (case is when 'measurements.title =' M_Bundet_Klor '' as the decimal (18, 2)) and the zero (end) as es.value, ',', ''. ' AS (BondetKlor), SUM (case when measometers.title = 'M_Total_Klor' then CAST (repetre ()) (AS), in the form of decimal reposition (routines.value, ',', '.') Decimal (18, 2) routines.value, ',', '.') as DCIML (18, 2)) Total Calls, SUMs (cases when measuring. Title = 'MOPH' then re-cast (replacement value (routine value, ',', '.') As DCIMAL (18, 2)) zero end) physically handicapped, in the form of amount (case when measurements. Title = 'M_Auto_Klor' then the cast (routines.value REPLACE (, ',', '.') As decimal (18, 2)) and zero end) AutoKlor, in the form of zodiac (case when measurements.title = Join 'M_Auto_PH' in the form of routine (18, 2)) and zero end as routines.value REPLACE (, ','. '' '), Routine as autoPh routines.id = measure_ro at measure_routine measure_routine.measure_id = measurements.id on the inside interfaces measure_routine.pool_id = pools.id Join pool measurements where routines.date '". $ fraDato."' and '". $ tilDato."' and 'pool' Between .name = ''. $ basseng '' And routine. Between time ''. $ fraTid '' And ''. $ tilTid "Routines, Routines by Group. Time order by routine, routine. Time;    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -