Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select SQL
Message
From
01/07/2003 11:55:33
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00805730
Message ID:
00805733
Views:
15
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
Previous
Reply
Map
View

Click here to load this message in the networking platform