Solución:
Puedes hacer algo como esto:
(SELECT
name, games, goals
FROM tblMadrid WHERE name="ronaldo")
UNION
(SELECT
name, games, goals
FROM tblBarcelona WHERE name="messi")
ORDER BY goals;
Ver, por ejemplo: https://dev.mysql.com/doc/refman/5.0/en/union.html
Si le gusta mantener registros separados y no hacer la unión.
Prueba la consulta a continuación
SELECT (SELECT name,
games,
goals
FROM tblMadrid
WHERE name="ronaldo") AS table_a,
(SELECT name,
games,
goals
FROM tblBarcelona
WHERE name="messi") AS table_b
FROM DUAL
La declaración UNION es su amiga:
SELECT a.playername, a.games, a.goals
FROM tblMadrid as a
WHERE a.playername = "ronaldo"
UNION
SELECT b.playername, b.games, b.goals
FROM tblBarcelona as b
WHERE b.playername = "messi"
ORDER BY goals;
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)