Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Too Many Subqueries
Message
From
12/10/2001 13:11:37
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
12/10/2001 13:04:58
Peter Wagner
Point Informática Ltda.
Limeira, Brazil
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00567770
Message ID:
00567779
Views:
13
>Hi all,
>In a SQL SELECT command using 11 Tables I have 10 LEFT JOINS and
>1 INNER JOIN, but VFP returns a error message: TOO MANY SUBQUERIES.
>
>I'm not using Query Builder, and there arent Subqueries in the Command.
>If I use only 10 Tables it Works fine!
>
>Is there a restriction of how many Tables I can use in a SQL SELECT command
>in VFP, I searched all the documentation and havent found any mention
>that VFP handles only 10 Tables.
>
>Is there a workaround ?
>
>Thanks in Advance
>Peter
>
>The SELECT Command...
>
>
>SELECT Histmanu.*, Veiculo.placa, Veiculo.cd_cavalo,
>Veiculo.qt_km_ini,
>   Veiculo.qt_hr_ini, Veiculo.dt_atrela, Veiculo.qt_hr_acum,
>   Veiculo.qt_km_acum, Veiculo.bl_tracao, Veiculo.bl_medprop,
>   Veiculo.bl_km, Veiculo.bl_hr, Veiculo.tp_med_man,
>   Manut.nm_manut, Fornec.nm_fornec, Grupo.nm_grpserv,
>SubGrupo.nm_subgrup,
>   Filial.nm_filial, Ccusto.nm_Ccusto, Manuxrec.cd_recurso,
>Manuxrec.qt_horas, Manuxrec.vl_hora,
>   Usuario.nm_usuario, TpServ.nm_tpserv, FilAce.nm_filial as
>nm_fil_ace
>
> FROM Veiculo, Histmanu
> LEFT  JOIN Manut
>ON  Histmanu.cd_empresa = Manut.cd_empresa
>  AND Histmanu.cd_manut   = Manut.cd_manut
> LEFT JOIN Fornec
>ON  Histmanu.cd_fornec  = Fornec.cd_fornec
> LEFT JOIN Grupo
>  ON  Histmanu.cd_grpserv = Grupo.cd_grpserv
> LEFT  JOIN SubGrupo
>       ON  Histmanu.cd_subgrup = SubGrupo.cd_subgrup
> LEFT JOIN Filial
>  ON  Histmanu.cd_empresa = Filial.cd_empresa
>  AND Histmanu.cd_Filial  = Filial.cd_Filial
> LEFT JOIN Filial FilAce
>  ON  Histmanu.cd_empresa = FilAce.cd_empresa
>  AND Histmanu.cd_fil_ace = FilAce.cd_filial
> LEFT JOIN Ccusto
>  ON  Histmanu.cd_empresa = Ccusto.cd_empresa
>  AND Histmanu.cd_Ccusto  = Ccusto.cd_Ccusto
> LEFT JOIN Usuario
>  ON  Histmanu.cd_empresa = Usuario.cd_empresa
>  AND Histmanu.cd_usu_apr = Usuario.cd_usuario
> LEFT JOIN TpServ
>  ON  Histmanu.cd_empresa = TpServ.cd_empresa
>  AND Histmanu.cd_tpserv  = TpServ.cd_tpserv
> LEFT JOIN ManuxRec
>  ON  Histmanu.cd_empresa = ManuxRec.cd_empresa
>  AND Histmanu.nr_ordserv = ManuxRec.nr_ordserv
>
>WHERE Histmanu.cd_empresa = Veiculo.cd_empresa
>AND   Histmanu.cd_veiculo = Veiculo.cd_veiculo
>AND   (Histmanu.cd_empresa = 1
>AND   Histmanu.nr_ordserv  = 0
>AND   Histmanu.tp_manut = 'P')
>
Peter,
Yes not doumented but 10 is limit :( You would need to divide it. Do one part with nofilter than join to second part. ie:You have an inner join at top, first do that than another SQL with the result cursor (most records would be eliminated there).
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform