Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL ALL drops duplicates L Outer Join
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00279559
Message ID:
00279560
Vues:
13
>In VFP 3.0 on Windows 98:
>I report cost on all employee's (here or not) tool usage
>This is the SQL statement:
>SELECT ALL Employee.dept, PADL(ALLTRIM(Employee.employnum),4,"0") AS empno,Employee.ename, ;
> Good.partnumber, Good.partdesc, Good.dateaquire, Good.nquantity, ;
> Good.nprice, Good.title ;
> FROM datalist!good, Employee ;
> INTO CURSOR ITEMVIEW ;
> WHERE Good.empno = PADL(ALLTRIM(Employee.employnum),4,"0")
> UNION ;
> SELECT ALL " " AS dept, PADL(ALLTRIM(Good.empno),4,"0") AS empno,"*unknown*" AS ename, ;
> Good.partnumber, ;
> Good.partdesc, Good.dateaquire, Good.nquantity, Good.nprice, Good.title ;
> FROM Good ;
> WHERE Good.empno NOT IN ;
> (SELECT PADL(ALLTRIM(Employee.employnum),4,"0") as Empno ;
> FROM Employee)
>
>Each "HALF" of the statement counts to 961 and 80 respectfully.
>When I UNION them the record count becomes 1005 ...
>For the report I must have the the 36 records dropped included.
>Why is "ALL" in my SELECT ignored when enforcing UNION?
>How can I correct it?


Say UNION ALL rather than UNION
Michael P. Antonovich, MCSD
Email: mike@micmin.com
MicMin Associates - Orlando, FL


Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform