Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL select mind bender #1453
Message
De
22/07/1998 10:04:31
 
 
À
21/07/1998 22:40:56
Bruce Gilmour
Cal-Mour Consultants
Calgary, Alberta, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00119932
Message ID:
00120148
Vues:
37
>>>>OK - I had this done once and (of course) misplaced the solution. I have an A/P invoice table for example that contains invoices and payments. I want to display in a grid only those invoices that are outstanding using a view as the source. So far I've got
>>>>
>>>>CREATE SQL VIEW apinquiry AS ;
>>>>select * from awards!apmaster where apmaster.invoicenum ;
>>>>   in (select apmaster.vendornum, apmaster.invoicenum,
>>>>       sum(apmaster.tranamount) as sumamount where sumamount <> 0
>>>>       from awards!apmaster GROUP BY invoicenum ORDER BY
>>>>       vendornum,invoicenum)
>>>></PRE
>>>>
>>>>which gives me a 'function name missing ")"' error. What am I missing?
>>>>TIA
>>>Hmm the last couple of lines disappeared on the first message.
>>
>>
>>Bruce,
>>I haven't tested this, but I moved your final paren to BEFORE the 'Group By' clause.  See if it works.
>>
>><pre>
>>CREATE SQL VIEW apinquiry AS ;
>>select * from awards!apmaster where apmaster.invoicenum ;
>>   in (select apmaster.vendornum, apmaster.invoicenum,
>>       sum(apmaster.tranamount) as sumamount where sumamount <> 0
>>       from awards!apmaster) GROUP BY invoicenum ORDER BY
>>       vendornum,invoicenum
>>
>>HTH
>>Barbara
>
>Good thought but when I do that I get a "Subquery is invalid" error.

The sample subquery is trying to retrieve multiple columns and compare that to a single column. Set membership test compares a single data value to a column.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform