Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Unsupported subselect type
Message
De
22/02/2008 15:56:48
 
 
À
22/02/2008 15:41:02
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01295494
Message ID:
01295509
Vues:
19
I see 3 possibles solutions:

A) Use an index on LocGarment:
SELECT LocGarment
INDEX ON kLoc + kGarment TAG LocGarment

select G.cStyle, G.kGarment, G.cDescrip, G.nDefPrice, ;
       iif(INDEXSEEK (lkLoc + G.kGarment, .F., "LocGarment", "LocGarment"), "L", "X") as cType  ;
  from Garments G
B) USE a UDF:
select G.cStyle, G.kGarment, G.cDescrip, G.nDefPrice, ;
       GetType () as cType  ;
  from Garments G

FUNCTION GetType
*-- Return the type here
ENDFUNC
C) Fill out the cursor after the query:
select G.cStyle, G.kGarment, G.cDescrip, G.nDefPrice, " " as cType;
  from Garments G;
  INTO CURSOR curTemp READWRITE

SCAN
    SELECT LocGarment
    LOCATE FOR (LocGarment.kLoc == lkLoc) AND (LocGarment.kGarment = curTemp.kGarment)
    SELECT curTemp
    REPLACE cType WITH IIF (FOUND ("LocGarment"), "L", "X")
ENDSCAN
>Ok, let me think about getting the G. out. I still need a select though in my "real" code, rather than replacing the select with joins. The version that I offered was done to make the select easy to see (and generate an error).
>
>In the "real" code below:
>
>select G.cStyle, G.kGarment, G.cDescrip, G.nDefPrice, ;
>       iif(lkLoc in ;
>       (select LG.kLoc from LocGarment LG where LG.kGarment = G.kGarment), ;
>       "L", "X") as cType  ;
>  from Garments G
>
>... the error message is just that it needs a comma (I think that it's parsing the real error message and reporting on it). What I'm trying to do is to add and populate a calculated field (cType) so the subselect is located in the field list. I pulled it out just to see if being in the field list was the problem.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform