0

Sql out of order!

Hi, guy Follow query don't run: SELECT num_qte as num_qte, cod_car_plate as cod_car_plate, cod_affinity as cod_affinity, dt_effect_qte as dt_effect_qte, des_car_make as des_car_make, des_car_model as des_car_model, cod_risk_type as cod_risk_type, num_prev_policy as num_prev_policy, contact_id as idcontact FROM insurance_policy WHERE num_prev_policy IS NULL AND num_conver_policy IS NULL AND TO_DATE(dt_effect_qte) = TODAY(-350) AND DES_TYPE_TRANSACTION = 'NEWBUSINESS' AND COD_AFFINITY NOT IN (1, 6, 8, 9, 13, 15, 16, 17, 18, 38, 68, 69, 100, 101, 102, 118, 122, 123, 124, 163, 164, 165, 178, 185, 186, 187, 188, 189, 205, 206, 207, 225, 227, 229, 246, 247, 248, 250, 253, 256, 257, 258, 259, 261, 262, 267, 268, 269, 270, 272, 274, 275, 276, 277, 279, 280, 9038, 9863, 9880, 9881, 9882, 9883, 9884, 9885, 9886, 9887, 9935, 9941, 9947, 9950, 9961, 9965, 9966, 9967, 9968) AND cod_car_plate NOT IN (SELECT cod_car_plate as cod_car_plate, FROM insurance_policy WHERE TO_DATE(dt_effect_qte) = TODAY(+15) AND (DES_TYPE_TRANSACTION = 'RENEWALS' OR COD_AFFINITY NOT IN (9185, 9186, 9187) OR (num_prev_policy IS NOT NULL AND num_conver_policy IS NULL)) Why? Thank you

23rd Oct 2018, 2:55 PM
Salvatore Fabio Lino
Salvatore Fabio Lino - avatar
1 Respuesta
+ 4
It's hard to tell without a database or knowing what are you trying to achieve, don't you think?
5th Nov 2018, 3:56 AM
dρlυѕρlυѕ
dρlυѕρlυѕ - avatar