Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Correlated Subqueries not allowed in views?
Message
From
20/01/1999 09:22:54
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00177885
Message ID:
00177969
Views:
35
Barbara,

Thank you for your reply, but I don't see a UNION. (Of course I've stared stuff in the face before and not seen it. <g> ) The line
ceiling( (DaysToPaid() - IntCalc.ic_days) / 30 ) + 1
returns an integer which corresponds to the question "How many invoices should we have?" and I am attempting the subquery " (select count(*)from InterestDetails ... etc " to see how many of these invoices have actually been generated. In other words I 'm trying to answer the question "Do we need more interest invoices (ceiling etc.) than we've generated? (select etc.)"

I think I'm going to have to break this into a couple of queries to get the results I want.

Tks - Miles

>Miles,
>You need to have a UNION joining the two parts of the view. Test it in a PRG until you get a cursor you want, then use that code to create your view. Don't forget that with a UNION you need exactly the same field structure in both parts.
>
>HTH
>Barbara
>
>>Please have a look at the lines marked with "$". VFP returned the error "This type of query not allowed" when I tried to open the view. Does that refere to the subquery?
>>Is this type of subquery allowed in views in 6.0?
>>
>>Thanks - Miles Thompson
>>
>>create sql view lv_intcalcsource as ;
>>select InvHead.cinvoi_key, ;
>>	     <snip>
>>	InvHead.cPenRevAcc ;
>> from hea!InvHead inner join hea!Company ;
>>   on  InvHead.cCompa_Key = Company.cCompa_Key ;
>> where ;
>>    ( DaysToPaid() > IntCalc.ic_days .and. .not. lFullyPaid ) ;
>>     .or. ;
>>    ( lFullyPaid .and. ;
>>      ceiling( (DaysToPaid() - IntCalc.ic_days) / 30 ) + 1 > ;
>>$        (select count(*) ;
>>$             from InterestDetails ;
>>$             where InvHead.cInvoi_Key = cDet_InvoiKey) ) ;
>>  order by Company.cCompanyName, InvHead.dCompletionDate
>
Previous
Reply
Map
View

Click here to load this message in the networking platform