Précédent   Forum des professionnels en informatique > PHP > PHP & SGBD
PHP & SGBD Forum d'entraide sur les SGBD avec PHP. Avant de poster : FAQ BDD, toutes les FAQ PHP, cours BDD et sources BDD
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 08/06/2007, 16h52   #1
Invité régulier
 
Inscription : mai 2007
Messages : 18
Détails du profil
Informations personnelles :
Âge : 24

Informations forums :
Inscription : mai 2007
Messages : 18
Points : 5
Points : 5
Par défaut [SQL] problème de jointure

salut j'ai environ une 15-aines de tables sous mysql et je voudrais faire des jointures dessus j'ai essayer plein de méthode pour ajouter des clé étrangère mais aucune n'ont marchées


Code SQL :
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
-- phpMyAdmin SQL Dump
-- version 2.10.1
-- http://www.phpmyadmin.net
-- 
-- Serveur: localhost
-- Généré le : Ven 08 Juin 2007 à 13:57
-- Version du serveur: 5.0.37
-- Version de PHP: 5.2.2
 
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
 
-- 
-- Base de données: `projetbeta`
-- 
 
-- --------------------------------------------------------
 
-- 
-- Structure de la table `basereseau`
-- 
 
CREATE TABLE `basereseau` (
  `nbacces` int(5) NOT NULL,
  `license` varchar(20) NOT NULL DEFAULT '',
  `typeinst` varchar(20) NOT NULL DEFAULT '',
  `nbaccesteams` varchar(20) NOT NULL DEFAULT '',
  `lienbr` int(20) NOT NULL,
  `id_br` int(20) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY  (`id_br`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
 
-- 
-- Contenu de la table `basereseau`
-- 
 
INSERT INTO `basereseau` (`nbacces`, `license`, `typeinst`, `nbaccesteams`, `lienbr`, `id_br`) VALUES 
(6, '  aucune', '  basique', '  ACCESTEAMS', 666, 1),
(7, '  aucune', '  basique', '  ACCESTEAMS', 555, 2),
(9, '  aucune', '  basique', '  ACCESTEAMS', 999, 3),
(6, '  aucune', '  basique', '  ACCESTEAMS', 25, 4);
 
-- --------------------------------------------------------
 
-- 
-- Structure de la table `baseteams`
-- 
 
CREATE TABLE `baseteams` (
  `Type` varchar(20) NOT NULL DEFAULT '',
  `Matricule` varchar(20) NOT NULL,
  `Soc` varchar(20) NOT NULL DEFAULT '',
  `Profil` varchar(20) NOT NULL DEFAULT '',
  `Version` varchar(20) NOT NULL DEFAULT '',
  `raypertoire` varchar(20) NOT NULL DEFAULT '',
  `lienbt` int(20) NOT NULL,
  PRIMARY KEY  (`Matricule`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
-- 
-- Contenu de la table `baseteams`
-- 
 
INSERT INTO `baseteams` (`Type`, `Matricule`, `Soc`, `Profil`, `Version`, `raypertoire`, `lienbt`) VALUES 
('  standard', '  111255', '  142', '  bas', '  1a', '  D://', 25),
('  standard', '  111554', '  142', '  bas', '  1a', '  D://', 555),
('  standard', '  111555', '  142', '  bas', '  1a', '  D://', 666),
('  standard', '  191555', '  142', '  bas', '  1a', '  D://', 999);
 
-- --------------------------------------------------------
 
-- 
-- Structure de la table `baseteams2`
-- 
 
CREATE TABLE `baseteams2` (
  `Type2` varchar(20) NOT NULL DEFAULT '',
  `Matricule2` varchar(20) NOT NULL DEFAULT '',
  `Soc2` varchar(20) NOT NULL DEFAULT '',
  `Profil2` varchar(20) NOT NULL DEFAULT '',
  `Version2` varchar(20) NOT NULL DEFAULT '',
  `Repertoire2` varchar(20) NOT NULL DEFAULT '',
  `lienbt2` int(20) NOT NULL,
  PRIMARY KEY  (`Matricule2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
-- 
-- Contenu de la table `baseteams2`
-- 
 
INSERT INTO `baseteams2` (`Type2`, `Matricule2`, `Soc2`, `Profil2`, `Version2`, `Repertoire2`, `lienbt2`) VALUES 
('  normale', '  222645', '  125', '  haut ', '  1b', '  E://', 555),
('  normale', '  222666', '  125', '  haut ', '  1b', '  E://', 666),
('  normale', '  225666', '  125', '  haut ', '  1b', '  E://', 25),
('  normale', '  292666', '  125', '  haut ', '  1b', '  E://', 999);
 
-- --------------------------------------------------------
 
-- 
-- Structure de la table `baseteams3`
-- 
 
CREATE TABLE `baseteams3` (
  `Type3` varchar(20) NOT NULL DEFAULT '',
  `Matricule3` varchar(20) NOT NULL DEFAULT '',
  `Soc3` varchar(20) NOT NULL DEFAULT '',
  `Profil3` varchar(20) NOT NULL DEFAULT '',
  `Version3` varchar(20) NOT NULL DEFAULT '',
  `Repertoire3` varchar(20) NOT NULL DEFAULT '',
  `lienbt3` int(20) NOT NULL,
  PRIMARY KEY  (`Matricule3`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
-- 
-- Contenu de la table `baseteams3`
-- 
 
INSERT INTO `baseteams3` (`Type3`, `Matricule3`, `Soc3`, `Profil3`, `Version3`, `Repertoire3`, `lienbt3`) VALUES 
('  basique', '  442538', '  132', '  centrer', '  1c', '  F://', 25),
('  basique', '  444878', '  132', '  centrer', '  1c', '  F://', 555),
('  basique', '  444888', '  132', '  centrer', '  1c', '  F://', 666),
('  basique', '  449888', '  132', '  centrer', '  1c', '  F://', 999);
 
-- --------------------------------------------------------
 
-- 
-- Structure de la table `baseteams4`
-- 
 
CREATE TABLE `baseteams4` (
  `Type4` varchar(20) NOT NULL DEFAULT '',
  `Matricule4` varchar(20) NOT NULL DEFAULT '',
  `Soc4` varchar(20) NOT NULL DEFAULT '',
  `Profil4` varchar(20) NOT NULL DEFAULT '',
  `Version4` varchar(20) NOT NULL DEFAULT '',
  `Repertoire4` varchar(20) NOT NULL DEFAULT '',
  `lienbt4` int(20) UNSIGNED NOT NULL DEFAULT '0',
  PRIMARY KEY  (`Matricule4`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
-- 
-- Contenu de la table `baseteams4`
-- 
 
INSERT INTO `baseteams4` (`Type4`, `Matricule4`, `Soc4`, `Profil4`, `Version4`, `Repertoire4`, `lienbt4`) VALUES 
('  exeptionnelle', '  552578', '  412', '  bas', '  1d', '  D://', 25),
('  exeptionnelle', '  555488', '  412', '  bas', '  1d', '  D://', 555),
('  exeptionnelle', '  555888', '  412', '  bas', '  1d', '  D://', 666),
('  exeptionnelle', '  555898', '  412', '  bas', '  1d', '  D://', 999);
 
-- --------------------------------------------------------
 
-- 
-- Structure de la table `client`
-- 
 
CREATE TABLE `client` (
  `nom` text NOT NULL,
  `adresse` varchar(50) NOT NULL DEFAULT '',
  `telephone` varchar(15) NOT NULL DEFAULT '',
  `datecont` text NOT NULL,
  `heurecont` varchar(10) NOT NULL DEFAULT '',
  `descriptionop` text NOT NULL,
  `validop` text NOT NULL,
  `lienclt` int(10) NOT NULL,
  `id_clt` int(20) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY  (`id_clt`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
 
-- 
-- Contenu de la table `client`
-- 
 
INSERT INTO `client` (`nom`, `adresse`, `telephone`, `datecont`, `heurecont`, `descriptionop`, `validop`, `lienclt`, `id_clt`) VALUES 
('  Darma', '  12 rue moineau', '  0125233698', '  12-05-2004', '  10h', '  Test', '  Mr Test', 666, 3),
('  Darma', '  12 rue moineau', '  0125233698', '  12-05-2004', '  10h', '  Test', '  Mr Test', 555, 4),
('mundi', '  12 rue moineau', '  0125233698', '  12-05-2004', '  10h', '  Test', '  Mr Test', 999, 5),
('  Darma', '  12 rue moineau', '  0125233698', '  12-05-2004', '  10h', '  Test', '  Mr Test', 25, 6);
 
-- --------------------------------------------------------
 
-- 
-- Structure de la table `communication`
-- 
 
CREATE TABLE `communication` (
  `module` varchar(20) NOT NULL DEFAULT '',
  `vairsion` varchar(20) NOT NULL DEFAULT '',
  `host` varchar(20) NOT NULL DEFAULT '',
  `autre` varchar(100) NOT NULL DEFAULT '',
  `liencom` int(20) NOT NULL,
  `id_com` int(20) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY  (`id_com`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
 
-- 
-- Contenu de la table `communication`
-- 
 
INSERT INTO `communication` (`module`, `vairsion`, `host`, `autre`, `liencom`, `id_com`) VALUES 
('  test', '  8c', '  hosted', '  ras', 666, 3),
('  test', '  8c', '  hosted', '  ras', 555, 4),
('  test', '  8c', '  hosted', '  ras', 999, 5),
('  test', '  8c', '  hosted', '  ras', 25, 6);
 
-- --------------------------------------------------------
 
-- 
-- Structure de la table `droitinfo`
-- 
 
CREATE TABLE `droitinfo` (
  `repertoire` varchar(20) NOT NULL DEFAULT '',
  `basereg` varchar(20) NOT NULL DEFAULT '',
  `autres` varchar(50) NOT NULL DEFAULT '',
  `liendroitinf` int(20) NOT NULL,
  `id_droitinf` int(20) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY  (`id_droitinf`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
 
-- 
-- Contenu de la table `droitinfo`
-- 
 
INSERT INTO `droitinfo` (`repertoire`, `basereg`, `autres`, `liendroitinf`, `id_droitinf`) VALUES 
('  D://TEAMS', '  baseregistre', ' ras', 666, 3),
('  D://TEAMS', '  baseregistre', ' ras', 555, 4),
('  D://TEAMS', '  baseregistre', ' ras', 999, 5),
('  D://TEAMS', '  baseregistre', ' ras', 25, 6);
 
-- --------------------------------------------------------
 
-- 
-- Structure de la table `images`
-- 
 
CREATE TABLE `images` (
  `img_id` int(20) UNSIGNED NOT NULL,
  `img_nom` varchar(50) NOT NULL,
  `img_taille` varchar(25) NOT NULL,
  `img_type` varchar(25) NOT NULL,
  `img_desc` varchar(100) NOT NULL,
  `img_blob` blob NOT NULL,
  `lienimg` int(20) NOT NULL,
  PRIMARY KEY  (`img_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
-- 
-- Contenu de la table `images`
-- 
 
 
-- --------------------------------------------------------
 
-- 
-- Structure de la table `intervention`
-- 
 
CREATE TABLE `intervention` (
  `Typeint` varchar(50) NOT NULL DEFAULT '',
  `Date` text NOT NULL,
  `Numcacao` varchar(20) NOT NULL DEFAULT '',
  `Duree` varchar(10) NOT NULL DEFAULT '',
  `Transport` varchar(20) NOT NULL DEFAULT '',
  `Montantfrais` varchar(20) NOT NULL DEFAULT '',
  `Intervenant` varchar(20) NOT NULL DEFAULT '',
  `Nomlab` varchar(20) NOT NULL DEFAULT '',
  `heuredeb` varchar(10) NOT NULL DEFAULT '',
  `heurefin` varchar(20) NOT NULL DEFAULT '',
  `lienint` int(20) NOT NULL,
  PRIMARY KEY  (`Numcacao`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
-- 
-- Contenu de la table `intervention`
-- 
 
INSERT INTO `intervention` (`Typeint`, `Date`, `Numcacao`, `Duree`, `Transport`, `Montantfrais`, `Intervenant`, `Nomlab`, `heuredeb`, `heurefin`, `lienint`) VALUES 
('  longue', '  15-05-2004', '  123546-4', '  4h', '  Metro', '  2euros', '  Mr test', '  Darma', '  15h', '  19h', 555),
('  longue', '  15-05-2004', '  123546-5', '  4h', '  Metro', '  2euros', '  Mr test', '  Darma', '  15h', '  19h', 666),
('  longue', '  15-05-2004', '  125546-5', '  4h', '  Metro', '  2euros', '  Mr test', '  Darma', '  15h', '  19h', 25),
('  longue', '  15-05-2004', '  129546-5', '  4h', '  Metro', '  2euros', '  Mr test', '  Darma', '  15h', '  19h', 999);
 
-- --------------------------------------------------------
 
-- 
-- Structure de la table `materiel`
-- 
 
CREATE TABLE `materiel` (
  `Marque` varchar(20) NOT NULL DEFAULT '',
  `Modele` varchar(20) NOT NULL DEFAULT '',
  `CPU` varchar(20) NOT NULL DEFAULT '',
  `Ram` varchar(20) NOT NULL DEFAULT '',
  `OS` varchar(20) NOT NULL DEFAULT '',
  `IE` varchar(20) NOT NULL DEFAULT '',
  `Connexion` varchar(20) NOT NULL DEFAULT '',
  `Utilisateur` varchar(20) NOT NULL DEFAULT '',
  `otre` varchar(20) NOT NULL DEFAULT '',
  `lienmat` int(10) NOT NULL,
  `id_mat` int(10) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY  (`id_mat`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
 
-- 
-- Contenu de la table `materiel`
-- 
 
INSERT INTO `materiel` (`Marque`, `Modele`, `CPU`, `Ram`, `OS`, `IE`, `Connexion`, `Utilisateur`, `otre`, `lienmat`, `id_mat`) VALUES 
('  azy', '  a1', '  core intel', '  1024', '  windows', '  7', '  adsl', '  user', '  ras', 666, 1),
('  azy', '  a1', '  core intel', '  1024', '  windows', '  7', '  adsl', '  user', '  ras', 555, 2),
('  azy', '  a1', '  core intel', '  1024', '  windows', '  7', '  adsl', '  user', '  ras', 999, 3),
('  azy', '  a1', '  core intel', '  1024', '  windows', '  7', '  adsl', '  user', '  ras', 25, 4);
 
-- --------------------------------------------------------
 
-- 
-- Structure de la table `materiel2`
-- 
 
CREATE TABLE `materiel2` (
  `Marque2` varchar(20) NOT NULL DEFAULT '',
  `Modele2` varchar(20) NOT NULL DEFAULT '',
  `CPU2` varchar(20) NOT NULL DEFAULT '',
  `Ram2` varchar(20) NOT NULL DEFAULT '',
  `OS2` varchar(20) NOT NULL DEFAULT '',
  `IE2` varchar(20) NOT NULL DEFAULT '',
  `Connexion2` varchar(20) NOT NULL DEFAULT '',
  `Utilisateur2` varchar(20) NOT NULL DEFAULT '',
  `Autre2` varchar(20) NOT NULL DEFAULT '',
  `lienmat2` int(10) NOT NULL,
  `id_mat2` int(20) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY  (`id_mat2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
 
-- 
-- Contenu de la table `materiel2`
-- 
 
INSERT INTO `materiel2` (`Marque2`, `Modele2`, `CPU2`, `Ram2`, `OS2`, `IE2`, `Connexion2`, `Utilisateur2`, `Autre2`, `lienmat2`, `id_mat2`) VALUES 
('  aze', '  a2', '  core intel', '  2048', '  windows', '  8', '  phone', '  user2', '  ras', 666, 3),
('  aze', '  a2', '  core intel', '  2048', '  windows', '  8', '  phone', '  user2', '  ras', 555, 4),
('  aze', '  a2', '  core intel', '  2048', '  windows', '  8', '  phone', '  user2', '  ras', 999, 5),
('  aze', '  a2', '  core intel', '  2048', '  windows', '  8', '  phone', '  user2', '  ras', 25, 6);
 
-- --------------------------------------------------------
 
-- 
-- Structure de la table `materiel3`
-- 
 
CREATE TABLE `materiel3` (
  `Marque3` varchar(20) NOT NULL DEFAULT '',
  `Modele3` varchar(20) NOT NULL DEFAULT '',
  `CPU3` varchar(20) NOT NULL DEFAULT '',
  `Ram3` varchar(20) NOT NULL DEFAULT '',
  `OS3` varchar(20) NOT NULL DEFAULT '',
  `IE3` varchar(20) NOT NULL DEFAULT '',
  `Connexion3` varchar(20) NOT NULL DEFAULT '',
  `Utilisateur3` varchar(20) NOT NULL DEFAULT '',
  `Autre3` varchar(20) NOT NULL DEFAULT '',
  `lienmat3` int(10) NOT NULL,
  `id_mat3` int(11) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY  (`id_mat3`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
 
-- 
-- Contenu de la table `materiel3`
-- 
 
INSERT INTO `materiel3` (`Marque3`, `Modele3`, `CPU3`, `Ram3`, `OS3`, `IE3`, `Connexion3`, `Utilisateur3`, `Autre3`, `lienmat3`, `id_mat3`) VALUES 
('  azr', '  a3', '  amd', '  512', '  windows', '  7', '  adsl', '  user3', '  ras', 666, 3),
('  azr', '  a3', '  amd', '  512', '  windows', '  7', '  adsl', '  user3', '  ras', 555, 4),
('  azr', '  a3', '  amd', '  512', '  windows', '  7', '  adsl', '  user3', '  ras', 999, 5),
('  azr', '  a3', '  amd', '  512', '  windows', '  7', '  adsl', '  user3', '  ras', 25, 6);
 
-- --------------------------------------------------------
 
-- 
-- Structure de la table `materiel4`
-- 
 
CREATE TABLE `materiel4` (
  `Marque4` varchar(20) NOT NULL DEFAULT '',
  `Modele4` varchar(20) NOT NULL DEFAULT '',
  `CPU4` varchar(20) NOT NULL DEFAULT '',
  `Ram4` varchar(20) NOT NULL DEFAULT '',
  `OS4` varchar(20) NOT NULL DEFAULT '',
  `IE4` varchar(20) NOT NULL DEFAULT '',
  `Connexion4` varchar(20) NOT NULL DEFAULT '',
  `Utilisateur4` varchar(20) NOT NULL DEFAULT '',
  `Autre4` varchar(20) NOT NULL DEFAULT '',
  `lienmat4` int(10) NOT NULL,
  `id_mat4` int(20) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY  (`id_mat4`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
 
-- 
-- Contenu de la table `materiel4`
-- 
 
INSERT INTO `materiel4` (`Marque4`, `Modele4`, `CPU4`, `Ram4`, `OS4`, `IE4`, `Connexion4`, `Utilisateur4`, `Autre4`, `lienmat4`, `id_mat4`) VALUES 
('  azu', '  a4', '  amd', '  256', '  linux', '  8', '  adsl', '  user4', '  ras', 666, 3),
('  azu', '  a4', '  amd', '  256', '  linux', '  8', '  adsl', '  user4', '  ras', 555, 4),
('  azu', '  a4', '  amd', '  256', '  linux', '  8', '  adsl', '  user4', '  ras', 999, 5),
('  azu', '  a4', '  amd', '  256', '  linux', '  8', '  adsl', '  user4', '  ras', 25, 6);
 
-- --------------------------------------------------------
 
-- 
-- Structure de la table `rmqclt`
-- 
 
CREATE TABLE `rmqclt` (
  `rmqclt` text NOT NULL,
  `rmqclt2` text NOT NULL,
  `rmqclt3` text NOT NULL,
  `rmqclt4` text NOT NULL,
  `rmqclt5` text NOT NULL,
  `rmqclt6` text NOT NULL,
  `lienrmqclt` int(20) NOT NULL,
  `id_rmqclt` int(20) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY  (`id_rmqclt`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
 
-- 
-- Contenu de la table `rmqclt`
-- 
 
INSERT INTO `rmqclt` (`rmqclt`, `rmqclt2`, `rmqclt3`, `rmqclt4`, `rmqclt5`, `rmqclt6`, `lienrmqclt`, `id_rmqclt`) VALUES 
(' remarque test', '    ', ' remarque test2', '    ', '    ', '    ', 666, 1),
(' remarque test', '    ', ' remarque test2', '    ', '    ', '    ', 555, 2),
(' remarque test', '    ', ' remarque test2', '    ', '    ', '    ', 999, 3),
(' remarque test', '    ', ' remarque test2', '    ', '    ', '    ', 25, 4);
 
-- --------------------------------------------------------
 
-- 
-- Structure de la table `rmqint`
-- 
 
CREATE TABLE `rmqint` (
  `rmq` text NOT NULL,
  `rmq2` text NOT NULL,
  `rmq3` text NOT NULL,
  `rmq4` text NOT NULL,
  `rmq5` text NOT NULL,
  `rmq6` text NOT NULL,
  `rmq7` text NOT NULL,
  `rmq8` text NOT NULL,
  `rmq9` text NOT NULL,
  `rmq10` text NOT NULL,
  `rmq11` text NOT NULL,
  `rmq12` text NOT NULL,
  `rmq13` text NOT NULL,
  `rmq14` text NOT NULL,
  `rmq15` text NOT NULL,
  `lienrmqint` int(20) NOT NULL,
  `id_rmqint` int(11) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY  (`id_rmqint`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
 
-- 
-- Contenu de la table `rmqint`
-- 
 
INSERT INTO `rmqint` (`rmq`, `rmq2`, `rmq3`, `rmq4`, `rmq5`, `rmq6`, `rmq7`, `rmq8`, `rmq9`, `rmq10`, `rmq11`, `rmq12`, `rmq13`, `rmq14`, `rmq15`, `lienrmqint`, `id_rmqint`) VALUES 
(' remarque', '    ', '    ', ' remarque2', '    ', '    ', '    ', ' remarque3', ' remarque4', '    ', '    ', '    ', ' remarque5', '    ', '    ', 0, 2),
(' remarque', '    ', '    ', ' remarque2', '    ', '    ', '    ', ' remarque3', ' remarque4', '    ', '    ', '    ', ' remarque5', '    ', '    ', 0, 3),
(' remarque', '    ', '    ', ' remarque2', '    ', '    ', '    ', ' remarque3', ' remarque4', '    ', '    ', '    ', ' remarque5', '    ', '    ', 0, 4),
(' remarque', '    ', '    ', ' remarque2', '    ', '    ', '    ', ' remarque3', ' remarque4', '    ', '    ', '    ', ' remarque5', '    ', '    ', 0, 5);



voici les tables si quelqu'un peut me dire les requetes a formuler sa serait sympa merci
vinz78 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/06/2007, 07h04   #2
Inscrit
 
Avatar de is_null
 
Inscription : octobre 2006
Messages : 637
Détails du profil
Informations forums :
Inscription : octobre 2006
Messages : 637
Points : 690
Points : 690
Beaucoup de requetes sont possibles, mais je recommande vivement de revoir la structure de la base de donnees avant tout, si il est encore temps.
Au lieu d'avoir par example des tables baseteam1, 2, 3 et 4, pourquoi ne pase faire une table base_group avec un id de group et des infos specifiques au groupes, et ajouter un id_group a baseteam ?
Cardinalite : (1,1) baseteams<-- id_group -->basegroups (1,n)

A part cela, je vous propose d'expliquer les requetes que vous voulez, ou de demander de l'aide quand a la restructuration de la base de donnees si elle n'est pas en production (j'espere).
__________________
Q: Dois-je haïr et cogner sur Microsoft ?
R: Non, vous n'êtes pas obligé. Non pas que Microsoft n'est pas écoeurant, mais il y avait une culture hacker bien avant Microsoft et il y en aura une bien après que Microsoft aura été de l'histoire ancienne. Toute énergie dépensée à haïr Microsoft serait mieux employée par vos compétences et votre passion. Écrivez du bon code, cela brisera suffisamment Microsoft sans polluer votre karma.
Comment devenir un hacker ? par Eric Steven Raymond
is_null est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 11/06/2007, 09h12   #3
Invité régulier
 
Inscription : mai 2007
Messages : 18
Détails du profil
Informations personnelles :
Âge : 24

Informations forums :
Inscription : mai 2007
Messages : 18
Points : 5
Points : 5
la base de donnée est en construction je peux donc la modifiée comme je l'entend. Je souheterai juste que toutes mes tables soient reliées pour cela il leur faut une clé externe et c'est la tout mon problème je ne maitrise pas assé bien mysql pour savoir comment procéder parce que la ma requete se décompose comme sa
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$query = "select *
         from client, baseteams, baseteams2, baseteams3, baseteams4, materiel, materiel2, materiel3, materiel4, intervention, basereseau, droitinfo, communication, rmqclt, rmqint
         where materiel.lienmat = baseteams.lienbt
         and materiel.lienmat = baseteams2.lienbt2
         and materiel.lienmat = baseteams3.lienbt3
         and materiel.lienmat = baseteams4.lienbt4
         and materiel.lienmat = intervention.lienint
         and client.lienclt = materiel.lienmat
         and materiel.lienmat = materiel2.lienmat2
         and materiel.lienmat = materiel3.lienmat3
         and materiel.lienmat = materiel4.lienmat4
         and materiel.lienmat = basereseau.lienbr
         and materiel.lienmat = droitinfo.liendroitinf
         and materiel.lienmat = communication.liencom
         and materiel.lienmat = rmqint.lienrmqint
         and materiel.lienmat = rmqclt.lienrmqclt
         and ".$mat." like '%".$lienmat."%'";
pour toute mes tables et cela ne marche pas.
Je me suis renseigné avec l'aide mysql mais je n'ai pas très bien compris les histoire d'index si quelqu'un peut me donner un exemple à partir d'une table de ma base de donnée sa serait cool
vinz78 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 11/06/2007, 10h09   #4
Invité régulier
 
Inscription : mai 2007
Messages : 18
Détails du profil
Informations personnelles :
Âge : 24

Informations forums :
Inscription : mai 2007
Messages : 18
Points : 5
Points : 5
J'ai réussi finalement à créer des foreign key cependant je ne peux le faire que une fois par table lorsque je veux mettre une deuxième clé étrangère il me sort cette erreur


Erreur

requête SQL:
Code SQL :
1
2
ALTER TABLE `basereseau` ADD CONSTRAINT `basereseau_ibfk_1` FOREIGN KEY ( `lien` ) REFERENCES `client` ( `lien` ) ON DELETE CASCADE ,
ADD CONSTRAINT `basereseau_ibfk_2` FOREIGN KEY ( `lien` ) REFERENCES `baseteams` ( `lien` ) ON DELETE CASCADE

Citation:
MySQL a répondu:Documentation
#1005 - Can't create table '.\projetbeta\#sql-498_1ac.frm' (errno: 121)


c'est bon j'ai trouvé c'est juste que mes clés portaient le même nom



donc pour ceux qui ont une erreur 150 ou 121 vérifiez d'avoir fait un index sur votre clé étrangère et que vos clés ne portent pas le même nom pensez aux virgules dans la syntaxe et tout devrait fonctionner

voici un exemple pour la syntaxe
Code SQL :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
CREATE TABLE `communication` (
  `module` varchar(20) NOT NULL DEFAULT '',
  `vairsion` varchar(20) NOT NULL DEFAULT '',
  `host` varchar(20) NOT NULL DEFAULT '',
  `autre` varchar(100) NOT NULL DEFAULT '',
  `liencom` int(20) NOT NULL,
  `id_com` int(20) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY  (`id_com`),
  INDEX(`liencom`),
  FOREIGN KEY(`liencom`) REFERENCES `client`(`lienclt`),
  FOREIGN KEY(`liencom`) REFERENCES `basereseau`(`lienbr`),
  FOREIGN KEY(`liencom`) REFERENCES `baseteams`(`lienbt`),
  FOREIGN KEY(`liencom`) REFERENCES `baseteams2`(`lienbt2`),
  FOREIGN KEY(`liencom`) REFERENCES `baseteams3`(`lienbt3`),
  FOREIGN KEY(`liencom`) REFERENCES `baseteams4`(`lienbt4`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;

Voilà merci @+
vinz78 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 11h37.


 
 
 
 
Partenaires

Hébergement Web