Case SQLServer, how to proceed?

2

I'm trying to display a column that is set to 0 and 1 so that by 0 it shows 'Ok' and then 1 'NOK'.

Here is my code that is not working, but by the query slq

String query1 = "Select DATA,HORA,RCPERFIL,BPCS,N_ETIQUETA,EMV_MIN,EMV_MAX,TMV,"
    + "ET5_MIN,ET5_MAX,TT5,"
    + "ETS2_MIN,ETS2_MAX,TTS2,"
    + "ET90_MIN, ET90_MAX,TT90,"
    + "EDENS_MIN,EDENS_MAX,TDENS,[EC-CHART],EBLOOMING = (CASE when EBLOOMING = '0 'then 'ok' else 'nok' END from
       QRY_MIX_LCSOMA where CONTAGEM_APROV = '0' and TIPOTESTE = 'Filtrado'
       ORDER BY DATA,HORA DESC";
    
asked by anonymous 13.11.2017 / 14:41

1 answer

2

I noticed that your select failed to close the (), as it is using a subselect it is necessary to use the select clause and its case is checking '0' and not '0' basing me on sql server your subselect would look like this:

(SELECT CASE when EBLOOMING = '0' then 'ok' else 'nok' AS NOMECOLUNA END from
       QRY_MIX_LCSOMA where CONTAGEM_APROV = '0' and TIPOTESTE = 'Filtrado')

NOTE: I removed the order by being a subselect

    
13.11.2017 / 14:59