Bonjour à tous,
J'ai un petit probléme intéréssant.
Tout d'abord voici le code :
Voila je voudrais savoir s'il y a une facon quelconque pour regrouper pour reduire la requete parce que quand tous ont leurs case 1.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 switch (ddlCritere1.SelectedIndex) { case 1: requete += " and id_phone in (select id_phone from operation where id_operation_type = 3)"; break; case 2: requete += " and id_phone not in (select id_phone from operation where id_operation_type = 3)"; break; default: break; } switch (ddlCritere2.SelectedIndex) { case 1: requete += " and id_phone in (select id_phone from operation where id_operation_type = 8) "; break; case 2: requete += " and id_phone not in (select id_phone from operation where id_operation_type = 8) "; break; default: break; } switch (ddlCritere2Bis.SelectedIndex) { case 0: if (ddlCritere2.SelectedIndex > 0) requete += ")"; break; default: if (ddlCritere2.SelectedIndex > 0) requete += " and operation_name = '" + ddlCritere2Bis.SelectedValue + "')"; break; } switch (ddlCritere3.SelectedIndex) { case 1: requete += " and id_phone in (select id_phone from operation where id_operation_type = 9) "; break; case 2: requete += " and id_phone not in (select id_phone from operation where id_operation_type = 9) "; break; default: break; }
ca fait un truc du genre :
and id_phone in (select id_phone from operation where id_operation_type = 3)and id_phone in (select id_phone from operation where id_operation_type = 8)and id_phone in (select id_phone from operation where id_operation_type = 9)
donc voila esce possible d'arriver à :
and id_phone in ( select id_phone from operation where id_operation_type in (3,8,9) ???
Merci d'avance .
Partager