Bonjour,
J'ai une table base de données SQLite avec un champ String qui contient plusieurs mots séparés par ','
Supposant que catégorie = "gestion,informatique,langue"
Le problème c'est que je n'arrive pas à savoir comment faire une requête qui récupère tout les centres de formations ayant comme catégorie "gestion".
La structure de mon code d'accès et manipulation de la base de données est la suivante:
-une classe de déclaration d'un objet "centreFormation"
- une classe création des colonnes de la table
-une classe pour la manipulation des données de la table.

Ci-dessous la classe de manipulation des données et j'utilise la méthode recupererChoixFormations(String ville, String catégorie) pour effectuer la récupération des centres.
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
public final class FormationBDD {
 
	private static final int VERSION_BDD = 11;
	private static final String NOM_BDD = "formations.db";
	private static final String TABLE_FORMATION = "table_formation";
	private static final String COL_ID = "_id";
	private static final int NUM_COL_ID = 0;
	private static final String COL_LIB = "libellé";
	private static final int NUM_COL_LIB = 1;
	private static final String COL_TEL = "tel";
	private static final int NUM_COL_TEL = 2;
	private static final String COL_EMAIL = "email";
	private static final int NUM_COL_EMAIL = 3;
	private static final String COL_ADR = "adresse";
	private static final int NUM_COL_ADR = 4;
	private static final String COL_VILLE = "ville";
	private static final int NUM_COL_VILLE = 5;
	private static final String COL_CAT= "catégorie";
	private static final int NUM_COL_CAT = 6;
	private static final String COL_LAT = "latitude";
	private static final int NUM_COL_LAT = 7;
	private static final String COL_LONG = "longitude";
	private static final int NUM_COL_LONG = 8;
 
 
	private SQLiteDatabase bdd;
 
	private MaBase maBaseSQLite;
 
	public FormationBDD(Context context){
		//On créer la BDD et sa table
		maBaseSQLite = new MaBase(context, NOM_BDD, null, VERSION_BDD);
	}
 
	public void open(){
		//on ouvre la BDD en écriture
		bdd = maBaseSQLite.getWritableDatabase();
	}
 
	public void close(){
		//on ferme l'accès à la BDD
		bdd.close();
	}
 
	public SQLiteDatabase getBDD(){
		return bdd;
	}
 
 
	public Cursor recupererChoixFormations(String ville, String catégorie){
		return bdd.query(TABLE_FORMATION, new String[] {COL_ID, COL_LIB, COL_TEL, COL_EMAIL, COL_ADR, COL_VILLE, COL_CAT, COL_LAT, COL_LONG}, 
		         COL_VILLE + " LIKE ? and " + COL_CAT + " LIKE ?",
		         new String[] { ville, catégorie }, 
		         null, null, null);
	}
	public void Truncate(){
		bdd.execSQL("DELETE FROM " +TABLE_FORMATION+";" );
	}
 
 
 
}
Merci d'avance pour votre aide