Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Group by clause changes and keeping sql dynamic
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00798958
Message ID:
00798967
Vues:
22
If you need it that dynamic, why not just create your select statement on the fly based on the structure of the table?

lnfields=afields(lafields)
for i=1 to lnfields
...
next i

>Suppose I have
>
>SELECT * FROM MYTABLE GROUP BY FIRSTFIELD, SECONDFIELD INTO TABLE MYTABLE2
>
>Assume that firstfield and secondfield are the only fields in the table, so this query works in 8.0.
>
>Now assume that someone adds a field to the table and this query now crashes because I don't have all of the fields in the group by clause.
>
>Let's assume that we were dynamically building this table everytime "something" ran. If a field was added to "mytable" then this would not work anymore and it really stops being dynamic, because now if this happens, we need to change the code.
>
>I suppose the proper way to handle this is to only select what you need so that way when you need something more than what you have already asked for you would need to go change the code anyway?
>
>How do you keep things dynamic with this change and if you are selecting * in the query? I tried using mytable.* but I get errors that way.
Wayne Myers, MCSD
Senior Consultant
Forte' Incorporated
"The only things you can take to heaven are those which you give away" Author Unknown
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform