Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Order By?
Message
De
23/12/1999 12:21:21
Jimmy Ditta
Twin City Electronics
Monroe, Louisiane, États-Unis
 
 
À
23/12/1999 11:54:20
Paul Frost
Instem Computer Systems Ltd
Stone, Royaume Uni
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00307929
Message ID:
00308003
Vues:
39
>>>>>what does it mean when a field is "not unique and must be qualified? example....
>>>>>
>>>>>select bundle,length,grade,siz,shipdataid;
>>>>>from data1,data2,data3,data4,data5,data6,data7,data8;
>>>>>where data1.shipdataid = data2.shipdataid;
>>>>>and data2.shipdataid = data3.shipdataid;
>>>>>and data3.shipdataid = data4.shipdataid;
>>>>>and data4.shipdataid = data5.shipdataid;
>>>>>and data5.shipdataid = data6.shipdataid;
>>>>>and data6.shipdataid = data7.shipdataid;
>>>>>and data7.shipdataid = data8.shipdataid;
>>>>>and data8.shipdataid = data1.shipdataid;
>>>>>and grade = gdValue and siz = szValue and length = 2 ;
>>>>>into cursor myCursor
>>>>>
>>>>>
>>>>>I've got a nasty report to create, and (ha,ha) I'm trying to teach myself how to use cursors.
>>>> At least one of the fields in the field selection list (in this case, definitely shipdataid, possibly other) occurs in two or more of the tables, so you must specify which table it should be selected from :
>>>>
>>>>select bundle,length,grade,siz,data1.shipdataid;
>>>>......
>>>>
>>>>Paul
>>>
>>>You could also remove one of the where criteria
>>>
>>>select bundle,length,grade,siz,data1.shipdataid;
>>>from data1,data2,data3,data4,data5,data6,data7,data8;
>>>where data2.shipdataid = data1.shipdataid;
>>>and data3.shipdataid = data1.shipdataid;
>>>and data4.shipdataid = data1.shipdataid;
>>>and data5.shipdataid = data1.shipdataid;
>>>and data6.shipdataid = data1.shipdataid;
>>>and data7.shipdataid = data1.shipdataid;
>>>and data8.shipdataid = data1.shipdataid;
>>>and grade = gdValue and siz = szValue and length = 2 ;
>>>into cursor myCursor
>>>
>>>Paul
>>
>>This cursor will be a little nastier than that, because the fields bundle,length,grade,siz,and shipdataid are fields in each of 8 tables, in which data satisfying 3 conditions must be pulled from.
>>
>>Stacy
>
>I think what you want is along the lines of
>
> select bundle,length,grade,siz,shipdataid;
> from data1 ;
> where grade = gdValue and siz = szValue and length = 2 ;
> union all
> select bundle,length,grade,siz,shipdataid;
> from data2 ;
> where grade = gdValue and siz = szValue and length = 2 ;
> ....;
> into cursor mycursor ;
> order by 5
>
>I will admit to getting to the end of my knowledge now, so someone with more knowledge of select may be able to help.
>
>Paul
////////////////////////////////////////////////////////////////////////////////
Ok, well i'm trying your method because it sounds logical, but i get a syntax error. can anyone see why? the code is:

select bundle,length,grade,siz,shipdataid;
from data1 ;
where grade = gdValue and siz = szValue and length = 2 ;
union all;
select bundle,length,grade,siz,shipdataid;
from data2 ;
where grade = gdValue and siz = szValue and length = 2 ;
union all;
select bundle,length,grade,siz,shipdataid;
from data3 ;
where grade = gdValue and siz = szValue and length = 2 ;
union all;
select bundle,length,grade,siz,shipdataid;
from data4 ;
where grade = gdValue and siz = szValue and length = 2 ;
union all;
select bundle,length,grade,siz,shipdataid;
from data5 ;
where grade = gdValue and siz = szValue and length = 2 ;
union all;
select bundle,length,grade,siz,shipdataid;
from data6 ;
where grade = gdValue and siz = szValue and length = 2 ;
union all;
select bundle,length,grade,siz,shipdataid;
from data7 ;
where grade = gdValue and siz = szValue and length = 2 ;
union all;
select bundle,length,grade,siz,shipdataid;
from data8 ;
where grade = gdValue and siz = szValue and length = 2 ;
union all;
into cursor mycursor ;

///////////////////////////////////////////////////////////////////////////////
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform