Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select SQL
Message
De
01/07/2003 11:55:33
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00805730
Message ID:
00805733
Vues:
14
Vinicius;

>
>tenho 2 tabelas:
>
>TAB1:
>Codigo - Nome
>1 - josé
>2 - Maria
>3 - Fulano
>4 - cicrano
>...
>
>TAB2:
>Codigo - Occorrencia
>1 - Matou aula dia 1
>1 - Matou aula dia 2
>1 - Matou aula dia 3
>-
>-
>4 - quebrou a vidraça
>...
>
>
>Eu quero q apareca TODOS os registros da TAB1 relacionados com TAB2, mesmo que nao tenha o registro de TAB1 correspondente em TAB2.
>
>Eu fiz assim:
>SELECT Tab1.Codigo, Tab2.Codigo from tab1, tab2 where tab1.codigo = tab2.codigo
>
>só que só retorna as linhas que são correspondentes. Queria que retornasse assim:
>
>SqlResult:
>Tab1.Codigo - Tab1.Nome - Tab2.Ocorrencia
>1 - Jose - Matou aula dia 1
>1 - Jose - Matou aula dia 2
>1 - Jose - Matou aula dia 3
>2 - Maria
>3 - Fulano
>4 - cicrano - quebrou a vidraça
>
>
SELECT tab1.*, tab2.*;
 FROM  tab1 INNER JOIN tab2 ;
   ON  tab1.codigo = tab2.codigo
Claudio
"Now to him who is able to do immeasurably more than all we ask or imagine, according to his power that is at work within us, Ephesians 3:20
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform