Ola preciso de uma ajuda na criacao de um select entre 2 tabelas onde tenho uma tabela Partida possui 2 campos time_casa, time_vizitante que sao chaves extrangeiras, e essa tabela eh ligada a uma tabela Time.
Duvida - como faço um select na tabela Partida que eu consiga o nome dos dois times???
segue o dump das 2 tabelas a baixo
Tabela Partida
CREATE TABLE `banco`.`partida` (
`id` int(10) unsigned NOT NULL auto_increment,
`hora` time NOT NULL,
`id_time_casa` int(10) unsigned NOT NULL,
`id_time_visitante` int(10) unsigned NOT NULL,
`resul_casa` int(10) unsigned NOT NULL,
`resul_visitante` int(10) unsigned NOT NULL,
`local` varchar(45) NOT NULL,
`id_rodada` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`),
KEY `id_time_casa` (`id_time_casa`),
KEY `id_time_visitante` (`id_time_visitante`),
KEY `id_rodada` (`id_rodada`),
CONSTRAINT `id_rodada` FOREIGN KEY (`id_rodada`) REFERENCES `rodada` (`id`),
CONSTRAINT `id_time_casa` FOREIGN KEY (`id_time_casa`) REFERENCES `time` (`id`),
CONSTRAINT
`id_time_visitante` FOREIGN KEY (`id_time_visitante`) REFERENCES `time` (`id`)
) ENGINE=InnoDB DEFAULT
CHARSET=latin1;
Tabela Time
CREATE TABLE `banco`.`time` (
`id` int(10) unsigned NOT NULL auto_increment,
`nome` varchar(50) NOT NULL,
`campo` varchar(50) NOT NULL,
`escudo` varchar(100) default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT
Publicidade
|
|
Page 1 of 1
AJUDAAA select!! fazer um select de uma tabela com 2 chaves extrangeiras
Share this topic:
Page 1 of 1
Similar Topics
| Topic | Forum | Started By | Stats | Last Post Info | |
|---|---|---|---|---|---|
|
Girar um mc com action script
|
Flash & ActionScript |
Petra
|
|
|
|
Vídeo brinca com rei da Tailândia e desencadeia bloqueio ao You Tube
|
Notícias |
Notícias
|
|
|
|
Bug "bom sábado" afeta Orkut e leva usuário e amigos à comunidade fictícia infectada
|
Notícias |
Notícias
|
|
|
|
MySpace começa a redefinir seu espaço
|
Notícias |
Notícias
|
|
|
|
Efeito de texto sendo digitado
Kero fazer um efeito como c o texto estivesse sendo digitado. |
After Effects | Premiere |
RiggsTronic
|
|
|
|
Efeito no texto
fazer o texto com formas |
Fireworks |
garcia_fg
|
|
|
|
JOGO 3ªPESSOA-PLZZ AJUDAAA
me ajudem a fazer um jogo 3ªpessoaa plxx |
Desenvolvimento de Jogos |
Muzkitu
|
|
|
|
problemas com menu drop e iframes
AJUDEM !!!!! |
Dreamweaver |
Abencoada
|
|
Publicidade
|
|

Help













