Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Syntax
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01023915
Message ID:
01023986
Vues:
18
Bonjour Boris,

I think that it is not necessary to have a whereclause...

SELECT RESIDENT.iid AS 'iresId',;
REPONDANT.iid AS 'irepid',;
REPONDANT.Lcopy;
FROM RESIDENT LEFT OUTER JOIN REPONDANT ;
ON RESIDENT.iid = REPONDANT.IRESIDENTID AND REPONDANT.Lcopy= .T.;
ORDER BY RESIDENT.iid INTO CURSOR TEMPS

bernhart



>You can't have, because for both records where REPONDANT.IRESIDENTID == 2 LCopy Value is .F.
>
>>Euh ... Ok there is still a problem
>>
>>I Have'nt resident.iid = 2
>>
>>
>>
>> CREATE CURSOR RESIDENT ( iid I )
>>
>>  CREATE CURSOR REPONDANT ( iid I , IRESIDENTID I , Lcopy L )
>>
>>  FOR x = 1 TO 6
>>    INSERT INTO RESIDENT ( iid  ) VALUES ( x )
>>  ENDFOR
>>
>>  INSERT INTO REPONDANT ( iid  , IRESIDENTID  , Lcopy  ) VALUES ( 1, 2 , .F.)
>>  INSERT INTO REPONDANT ( iid  , IRESIDENTID  , Lcopy  ) VALUES ( 2, 2 , .F.)
>>  INSERT INTO REPONDANT ( iid  , IRESIDENTID  , Lcopy  ) VALUES ( 3, 3 , .T.)
>>  INSERT INTO REPONDANT( iid  , IRESIDENTID  , Lcopy  ) VALUES ( 4, 5 , .F.)
>>  INSERT INTO REPONDANT( iid  , IRESIDENTID  , Lcopy  ) VALUES ( 5, 5 , .T.)
>>  INSERT INTO REPONDANT( iid  , IRESIDENTID  , Lcopy  ) VALUES ( 6, 5 , .T.)
>>
>>
>>  SELECT RESIDENT.iid AS 'iresId',;
>>    REPONDANT.iid AS 'irepid',;
>>    REPONDANT.Lcopy;
>>    FROM RESIDENT  LEFT OUTER JOIN REPONDANT ;
>>    ON  RESIDENT.iid = REPONDANT.IRESIDENTID;
>>    WHERE  REPONDANT.Lcopy IS NULL OR;
>>    REPONDANT.Lcopy  ;
>>    ORDER BY RESIDENT.iid INTO CURSOR TEMPS
>>
>>  *   I WANT
>>  *   iresid        irepid       lcopy
>>  *	1	NuLL		NULL
>>  *	2	    2         .F.  && last repondant
>>  *   	3              3         .T.
>>  *    	4              NULL      NULL
>>  *    	5              5          .T.
>>  *    	5              6          .T.
>>  *      6              NULL      NULL
>>
>>
>>  * I HAVE
>>  *	1	    NuLL	     NULL
>>  *    	3              3         .T.
>>  *    	4              NULL      NULL
>>  *    	5              5          .T.
>>  *      5               6	      .T.
>>  *    	6              NULL       NULL
>>
>>
>>
>>
>>
>>
>>
>>
>>>Hi,
>>>
>>>It looks like you might have an join problem to me:
>>>
>>>SELECT Resident.iid AS 'iresId',;
>>> Repondant.iid AS 'irepid';
>>> FROM amline!Resident ;
>>> LEFT OUTER JOIN amline!Repondant ;
>>> ON Resident.iid = Repondant.iresidentid;
>>> WHERE Repondant.lcopyfact ;
>>> ORDER BY Resident.iid
>>>
>>>you have this as a left outer join-- meaning that we can have as result with non null resident.iid but repondant.id is NULL. This means that repondant.lcopyfact is also null. Meaning that your left join is really identical to a simple inner join!
>>>
>>>Now I don't know if that is specifically your problem but it is a problem with the query.
>>>
>>>Hope that helps,
>>>Jamie
>>>
>>>
>>>
>>>>HI ALL,
>>>>
>>>>I have
>>>>
>>>>resident.dbf
>>>>IID I
>>>>
>>>>repondant.dbf
>>>>iid I
>>>>iresidentid I
>>>>lcopy L
>>>>
>>>>
>>>>I want ALL residents AND all repondants if lcopy = .T.
>>>>
>>>>This code do'nt function...
>>>>
>>>>
>>>>SELECT Resident.iid AS 'iresId',;
>>>> Repondant.iid AS 'irepid';
>>>> FROM amline!Resident ;
>>>>    LEFT OUTER JOIN amline!Repondant ;
>>>>   ON  Resident.iid = Repondant.iresidentid;
>>>> WHERE  Repondant.lcopyfact = ( .T. );
>>>> ORDER BY Resident.iid
>>>>
>>>>
>>>>
>>>>thank in advance
>>>>
>>>>bernhart
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform