Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Troublesome SQL construction
Message
De
20/12/2006 12:02:34
 
 
À
19/12/2006 18:37:58
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01179041
Message ID:
01179245
Vues:
10
>>So far, my results have either wound up with 3 Customers(cutting out 2 and 5) or 8 Customers because of the duplicates. I know this shouldn't be that hard, but I'm not seeing what I missed.
>
>
select t1.customer, t2.date, t3.size ;
> from customer t1 ;
>  left join orders t2 on t1.custID = t2.custID ;
>     and t2.date = (select max(date) from orders o1 where o1.cust_id = t2.custid ) ;
>  left join lookup t3 on t2.amount = t3.amount
Cetin

When I tried it in this format, I got the error 'SQL: Subquery nesting is too deep.' I moved it to a WHERE clause and essentially got Sergey's answer, except his gave the error 'SQL expression is too complex.' In both of them, the MAX(date) is excluding the blank records, which I need to keep.

After a night's sleep, a fresh look at the problem, I broke it out into two queries.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform