Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL error
Message
De
22/04/2015 05:14:23
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01618877
Message ID:
01618955
Vues:
47
>>If redeem.dredeemdat is BLANK the subselect does not catch the record, so no towfky is existent
>>
>>b.control is compared with towfky, on equal or identity if character field
>>
>>EMPTY b.control will only match EMPTY(towky), not non existent towfky
>>
>>
>>CREATE CURSOR ca (i1 c(1), d1 date)
>>INSERT INTO ca VALUES ("1", DATE())
>>INSERT INTO ca VALUES ("2", {..})
>>
>>CREATE CURSOR cb (i2 c(1),i3 c(1))
>>INSERT INTO cb VALUES ("1","A")
>>INSERT INTO cb VALUES ("2","B")
>>INSERT INTO cb VALUES ("","C")
>>
>>*no record C
>>SELECT * FROM cb WHERE i2 in (SELECT i1 FROM ca WHERE d1<=DATE()+1 AND d1>=DATE()-1)
>>
>>*no record C
>>INSERT INTO ca VALUES ("", {..})
>>SELECT * FROM cb WHERE i2 in (SELECT i1 FROM ca WHERE d1<=DATE()+1 AND d1>=DATE()-1)
>>
>>*record C
>>INSERT INTO ca VALUES ("", DATE())
>>SELECT * FROM cb WHERE i2 in (SELECT i1 FROM ca WHERE d1<=DATE()+1 AND d1>=DATE()-1)
>>
>
>
>CREATE CURSOR ca (i1 c(1), d1 date)
>INSERT INTO ca VALUES ("1", DATE())
>INSERT INTO ca VALUES ("2", {})
>
>CREATE CURSOR cb (i2 c(1),i3 c(1), i4 D)
>INSERT INTO cb VALUES ("1","A", DATE())
>INSERT INTO cb VALUES ("1","A", {})
>INSERT INTO cb VALUES ("2","B", {})
>INSERT INTO cb VALUES ("","C", {})
>
>*no record C BUT record A with empty date
>SELECT * FROM cb WHERE i2 in (SELECT i1 FROM ca WHERE d1<=DATE()+1 AND d1>=DATE()-1)
>
>*no record C BUT record A with empty date
>INSERT INTO ca VALUES ("", {..})
>SELECT * FROM cb WHERE i2 in (SELECT i1 FROM ca WHERE d1<=DATE()+1 AND d1>=DATE()-1)
>
>*record C AND record A with empty date
>INSERT INTO ca VALUES ("", DATE())
>SELECT * FROM cb WHERE i2 in (SELECT i1 FROM ca WHERE d1<=DATE()+1 AND d1>=DATE()-1)
>
>
>Are you sure that these are the records you need?

yes, those are the record you have asked for

All from cb that fit to the result of the subselect

in case 1
subselect returns
"1", cb records number 1,2 fit because i1 = "1"
in case 2
subselect returns
"1", cb records number 1,2 fit because i1 = "1"
in case 2
subselect returns
"1";"", cb records number 1,2 fit because i1 = "1" and additional ca record number 4 fit because i1 = ""

you have not asked for value of cb.i4 so it does not matter.

Update:
possibly clearer:
SELECT Cur1.* FROM cb AS Cur1 WHERE Cur1.i2 IN (SELECT Cur2.i1 FROM ca AS Cur2 WHERE Cur2.d1<=DATE()+1 AND Cur2.d1>=DATE()-1)
This is exactly the same as above, only with aliases mentioned
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform