Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Include NULL in the result
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01036945
Message ID:
01036996
Vues:
8
>>
>>SELECT DISTINCT padr(PROPER(ALLTRIM(Employees.cEmployee_first_name) + SPACE(1) + ;
>>	Employees.cEmployee_last_name), 50) AS cEmpName, ;
>>   Users.cUserID, Usgrlink.cUsgrlink_pk  ;
>> FROM Users INNER JOIN USGRLINK ;
>>   ON Users.iID = Usgrlink.iUserID ;
>>    INNER JOIN EMPLOYEE_TEAMS ;
>>   ON Employee_teams.cEmployee_teams_pk = Usgrlink.cEmployee_teams_fk ;
>>   INNER JOIN EMPLOYEES ;
>>   ON Users.cUsers_pk = Employees.cUsers_fk ;
>>   INNER JOIN Departments on Employee_teams.cDepartments_fk = Departments.cDepartments_pk ;
>>   UNION ;
>>   SELECT SPACE(50) as cEmpName, SPACE(10) as cUserID, CAST(null as C(16) NULL) as cUsGrLink_pk FROM Users WHERE RECNO() =1
>>
>>It works in VFP9. But I want to have SQL statement back-end independent
>
>I'm not sure how efficient following query will be but it shoud be backend independed
...
>SELECT SPACE(50) as cEmpName, SPACE(10) as cUserID, CAST(null as C(16) NULL) as cUsGrLink_pk
>	FROM Users
>
>	WHERE cUserID = (SELECT MIN(cUserID) FROM Users )
>or
>	WHERE cUserID = (SELECT MAX(cUserID) FROM Users )
>or
>	WHERE cUserID = (SELECT TOP cUserID FROM Users ORDER BY cUserID)
>
>
The original select works without any WHERE condition in the UNION portion and returns just one empty record. Are you saying, it would not work the same way in SQL Server?
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform