Requête Mysql--Selection de plusieursTables--
Dream
-
Christounet Messages postés 1272 Date d'inscription Statut Membre Dernière intervention -
Christounet Messages postés 1272 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
j'aimerais faire une requête mysql qui va me permettre de sélectionné les derniers enregistrement de plusieurs tables (table1+table2+table3) genre :
sql='SELECT id,titre FROM table1 table2 table3 order by id DESC LIMIT 5 '; mais je sais pas comment faire
merci
j'aimerais faire une requête mysql qui va me permettre de sélectionné les derniers enregistrement de plusieurs tables (table1+table2+table3) genre :
sql='SELECT id,titre FROM table1 table2 table3 order by id DESC LIMIT 5 '; mais je sais pas comment faire
merci
A voir également:
- Requête Mysql--Selection de plusieursTables--
- Mysql community server - Télécharger - Bases de données
- L'indice n'appartient pas à la sélection vba ✓ - <a href="https://forums.commentcamarche.net/forum/vb-vba-267">Forum VB / VBA</a>
- Erreur '9' l'indice n'appartient pas à la sélection - <a href="https://forums.commentcamarche.net/forum/vb-vba-267">Forum VB / VBA</a>
- Outil sélection illustrator ne fonctionne pas - <a href="https://forums.commentcamarche.net/forum/illustrator-150">Forum Illustrator</a>
- Impossible de modifier avec l'outil de sélection ✓ - <a href="https://forums.commentcamarche.net/forum/illustrator-150">Forum Illustrator</a>
5 réponses
la requete
sql='SELECT id,titre FROM table1 table2 table3 order by id DESC LIMIT 5 '; ça marche pas sniif
sql='SELECT id,titre FROM table1 table2 table3 order by id DESC LIMIT 5 '; ça marche pas sniif
Bonjour,
Tu peux utiliser l'instruction UNION
Cela te donneras 15 enregistrements.
A plus
Tu peux utiliser l'instruction UNION
SELECT id,titre FROM table1 order by id desc limit 5 UNION SELECT id,titre FROM table2 order by id desc limit 5 UNION SELECT id,titre FROM table3 order by id desc limit 5
Cela te donneras 15 enregistrements.
A plus
Merci pour ta réponse , je viens de faire Union mais erreur de requete peu etre j'ai oublié quelque chose !!
voila ce que j'ai mis :
$sql='SELECT id,titre FROM champ1 order by id DESC LIMIT 1 UNION
SELECT id,titre FROM champ2 order by id DESC LIMIT 1 ';
merci
voila ce que j'ai mis :
$sql='SELECT id,titre FROM champ1 order by id DESC LIMIT 1 UNION
SELECT id,titre FROM champ2 order by id DESC LIMIT 1 ';
merci
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question