Query filter [closed]

-1
modelo.setNumRows(0);
    Class.forName(Auxiliar.AcessoBanco.getDriver());
    Connection con = DriverManager.getConnection(Auxiliar.AcessoBanco.getUrl(), Auxiliar.AcessoBanco.getUser(), Auxiliar.AcessoBanco.getPass());
    String query1 = "Select id_ct, ORDEM ,CDLINHA, TIPOL,SETOR ,TCPERFIL,BPCS,DPERFIL ,PROJETO ,OEM,N_DESENHO ,N_PLANO,OPERACAO,EQUIPAMENTO, DESCTESTE,COMPLEMENTO, TCTESTE ,"
            + "ESPEC_MIN,ESPEC_MAX, ESPEC_UNID,ESPEC_TEXTO,REFERENCIA,"
            + "FREQUENCIA,FREQ_UNID,PRODUTO,ORIGEM,TIPO,ESPECTEXTO,"
            + "FREQTEXTO,LAB from QRY_RESULT where TCPERFIL = " + txt_perfil.getText() + "ORDER BY ORDEM asc";

As you can see .. I search for a "Profile" that contains several tests registered in it, but now I need to filter the tests that are related to the column "LAB" and that are "Yes" so that the person of the lab just put the values in the laboratory test. Can anyone tell me how I add this search in this query?

    
asked by anonymous 28.08.2017 / 17:19

1 answer

1

To bring only the records with the LAB column equal to Sim .

Modify your query to:

String query1 = "Select id_ct, ORDEM ,CDLINHA, TIPOL,SETOR ,TCPERFIL,BPCS,DPERFIL ,PROJETO ,OEM,N_DESENHO ,N_PLANO,OPERACAO,EQUIPAMENTO, DESCTESTE,COMPLEMENTO, TCTESTE ,"
            + "ESPEC_MIN,ESPEC_MAX, ESPEC_UNID,ESPEC_TEXTO,REFERENCIA,"
            + "FREQUENCIA,FREQ_UNID,PRODUTO,ORIGEM,TIPO,ESPECTEXTO,"
            + "FREQTEXTO,LAB from QRY_RESULT where TCPERFIL = " + txt_perfil.getText() + " and LAB = 'Sim' ORDER BY ORDEM asc";

adding and LAB = 'Sim'

    
28.08.2017 / 19:27