Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL - too many subqueries
Message
From
23/01/2006 20:58:19
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
23/01/2006 17:01:05
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01089549
Message ID:
01089620
Views:
15
If it is for a report, perhaps you can divide the query into smaller pieces? (Join a few tables, join the result with one or more additional tables.) This might also help make the query faster.

>I am getting the following error on some of the computerer at my client's office. I am using VFP9. Only a few of the computers are having problems with this query.
>
>
>   Too many subqueries.
>
>
>
>The offending code is:
>
>
>
>Select a.sif_no, b.insured, a.pol_status As pol_st_old,b.pol_status As pol_st_new, ;
>	a.est_prem, o.exp_mod As exp_mod_pct , b.incep_date, ;
>	NVL(e.PCT,0)As PCT , Nvl(F.Cnt,0) As NSF, Nvl(g.cancel_cnt,0) As no_pays, ;
>	a.agent_no, h.agent_status,Nvl(a.ctp,.F.)As ctp,Nvl(a.consent_rate,.F.) As consent_rate ;
>	,Nvl(i.flag7500,"    ")As flag_7500 , Nvl(i.res_premium,000000) As res_7500_prem, ;
>	NVL(j.res_premium,00000) As res_3000_prem, Nvl(j.flag3000,"    ") As flag_3000 , ;
>	NVL(a.other_flag,"    ") As other_flag , Nvl(a.other_pct,0) As other_pct ,;
>	NVL(k.lr_pct,0) As lr_pct , Nvl(l.cnt50000,0) As cnt50000  , Nvl(m.lr_policy,00000.0)As lr_policy, ;
>	NVL(N.frequency,0000) As frequency,  ;
>	IIF(Empty(a.safety_pct)  ," ","Y") As drugfree_cr,IIF(Empty(a.drugfree_pct)  ," ","Y") As safety_cr, ;
>	IIF(Empty(a.fccpap_pct)  ," ","Y") As fccpap_cr, ;
>	ICASE(a.limit1 = "500000","2",a.limit1 = "1000000","3"," ") As limits, Iif(a.bill_method = "2","Y", " ") As msa, ;
>	00 As sort_order, a.ctr_pct, a.ctp_ann, 000 As scorecard,Space(4) As star_lr ,Space(1) As star_50000, ;
>	SPACE(1) As star_freq,Space(1) As star_no_pay,Space(1) As star_nsf,Space(1) As star_exp_Mod,Space(1) As star_audit, ;
>	SPACE(1) As star_7500,Space(1) As star_3000,Space(1) As star_unappr ;
>	From tmpPolicy a ;
>	LEFT Join h:\ps_vfp\Master b On a.sif_no = b.sif_no ;
>	LEFT Join tmpAudit e On a.sif_no = e.sif_no ;
>	LEFT Join tmprtn_ck F On a.sif_no = F.sif_no ;
>	LEFT Join tmpcancels g On a.sif_no = g.sif_no  ;
>	LEFT Join tmpagents h On a.agent_no = h.agent_no ;
>	LEFT Join tmp_7500 i On a.sif_no = i.sif_no ;
>	LEFT Join tmp_3000 j On a.sif_no = j.sif_no ;
>	LEFT Join tmplr_agent k On a.agent_no = k.agent_no ;
>	LEFT Join tmp50000  l On  a.sif_no = l.sif_no ;
>	LEFT Join tmplr_policy m On a.sif_no = m.sif_no ;
>	LEFT Join tmpfrequency N On a.sif_no = N.sif_no ;
>	LEFT Join tmpExp_mod o On a.sif_no = o.sif_no ;
>	Into Cursor tmpagg Readwrite
>
>
>Anyone have any ideas why this creates an error in some of the computers and not the other. This is a VFP 9 application.
>Thanks
>
>Gaylen
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform