Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL-WHERE error en campo calculado
Message
 
 
À
26/01/2007 10:50:55
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 6
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01189655
Message ID:
01189660
Vues:
8
>Hola,
>Tengo el siguiente inconveniente:
>Hago el siguiente sql si probleas
>
>select a.codcli as cliente, a.codnom as nombre, ;
>porc_cal(a.impo1,b.impo1) as porcentje from tabla1 as a. tabla2 as b ;
>where (a.codcli = b.codcli) into table salida
>funciona ok...
>aparecen los tres campos
>cliente,nombre,porcentaje
>ahora bien si yo quiero hacer en el mismo sql que solamente me liste los de porcentajes > 10 me da el siguiente error "columna porcentaje no existe"
>y lo hago así.
>select a.codcli as cliente, a.codnom as nombre, ;
>porc_cal(a.impo1,b.impo1) as porcentje from tabla1 as a. tabla2 as b ;
>where ;
>(a.codcli = b.codcli) and (porcentje > 10) ;
>into table salida
>la unica diferencia con el sql anterior es:
>and (porcentje > 10)
>no encontre nada en el manual que me aclarara sobre el tema.
>Desde ya les agradezco por vuestro tiempo.
>Saludos

Sorry for the English, but you can not use calculated (new) columns in WHERE expression. You can use them in HAVING clause, but I never used HAVING without GROUP BY (AFAIK it's possible).

Perhaps you would need to do it in two select statements instead.

BTW, don't use single letter aliases for tables. Use at least two letters.
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