Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help with a union
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00666184
Message ID:
00666186
Vues:
14
This message has been marked as the solution to the initial question of the thread.
If understand you correctly, the tables are linked by 'dcode' field. In this case try
SELECT iif(!empty(localdesc),localdesc,DESCRIPTIO),PADR(dcode,15) AS dcode1 ;
	FROM (gcProcDBF) ;
	where screenoption=[RADIOLOGY] ;
	UNION ALL ;
	SELECT procalias, PADR(dcode,15) AS dcode1 ;
	FROM (gcPAlias) ;
	WHERE dcode IN ( SELECT dcode FROM (gcProcDBF) ;
			where screenoption=[RADIOLOGY] );
	ORDER BY 1 ;
	INTO ARRAY RADPROCS
>I have a table called proc.dbf and child table called palias.dbf
>
>I'm trying to return all records for a lookup from the proc.dbf and palias (dcode) is what they are common on. The query below will do that. BUT...always a but.. I'm filtering the query on the proc.dbf if the screen option = RADIOLOGY. This works on the top sql, but since the child table doesn't have that field, it returns all records from the palias table. So my question is how can I re-write this query to also apply the filter to the palias?
>
>Thanks for any help:
>
>
>gcProcDBF=[..\proc.dbf]
>gcPalias=[..\palias]
>SELECT iif(!empty(localdesc),localdesc,DESCRIPTIO),PADR(dcode,15) AS dcode1 ;
>	FROM &gcProcDBF ;
>	where screenoption=[RADIOLOGY] ;
>	UNION ALL ;
>	SELECT procalias, PADR(dcode,15) AS dcode1 ;
>	FROM &gcPAlias ;
>	ORDER BY 1 ;
>	INTO ARRAY RADPROCS
>
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform