Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Filter on left join?
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Filter on left join?
Divers
Thread ID:
00779136
Message ID:
00779136
Vues:
45
I'm having some real trouble filtering the results of the first table in a select statement to get the results I want.
SELECT ShowHours.HourNo, CalDates.*, Schedule.PK, PersCal.PK AS PersCalPK, ;
		PADR(Schedule.Subject,50) AS Subject, ;
		...etc...
	FROM .\Schedule ;
		WHERE AccessLvl <= loUserInfo.AccessLvl ; <---(I know this is improper syntax)
	LEFT OUTER JOIN ShowHours ;
		ON Schedule.StTime=HourNo ;
	LEFT OUTER JOIN .\SEIU790Data\EventType ;
		ON TypePK=Ety_PK ;
		AND AccessLvl <= loUserInfo.AccessLvl;
	RIGHT OUTER JOIN CalDates ;
		ON Schedule.StDate=DayDate ;
	ORDER BY 2, 1 ;
	INTO CURSOR TQuery1
I want to display only events with accesslvl at or below loUserInfo.AccessLvl - but I cannot use
	LEFT OUTER JOIN ShowHours ;
		ON Schedule.StTime=HourNo ;
		AND AccessLvl <= loUserInfo.AccessLvl
...because the LEFT OUTER JOIN includes them anyway.

I also can't use:
HAVING AccessLvl <= loUserInfo.AccessLvl
... because I need all the records in CalDates

Am I stuck breaking this into two SELECTS?

TIA
Kogo Michael Hogan

"Pinky, are you pondering what I'm pondering?"
I think so Brain, but "Snowball for Windows"?

Ideate Web Site
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform