Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Join on Where?
Message
De
11/02/2000 11:27:06
Michael Dougherty
Progressive Business Publications
Malvern, Pennsylvanie, États-Unis
 
 
À
11/02/2000 11:06:59
Oleg Khvalin
The Sutherland Group Ltd
Rochester, New York, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00330328
Message ID:
00330752
Vues:
16
>First of all, what is "dailylog"? You don't have this table in FROM clause.
It holds the working date, and information related to that date. In this case it's a constant value because i only want the time/sale/cxl info for one day.

>Second, try do not SELECT fields that you don't have in GROUP BY. Fox allows it, but standard SQL does not (I mean "sh.pub as pub") and its value very much questionable.
I'm not exactly sure what you mean. This program isn't likely to leave native VFP, so the standard SQL isn't a serious issue. (thanks for the warning though) I understand it's questionable because if there is no sale record, there will be no value. In this case, if there is no sale then there is no pub either.

>And the most important thing: your WHERE restricts results so you will not have reps without sales for this date (sh.date==dailylog.date).
If you want keep them, move conditions from WHERE to JOIN ON.
FROM timehist th left join salehist sh on th.repid==sh.repid ;
__AND sh.date==dailylog.date

Thanks very much for noticing this. I'd have gone crazy trying to find that later. So the Where is restricting AFTER the tables are joined?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform