Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select distinct code
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Vista
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01390055
Message ID:
01390060
Vues:
64
>hi all,
>I have a problem that I am sure can be solved with a tweak of my code. I have a table that looks like this
>
>order_num, unique_line_no, customer_code...
>2345              123456            ABC
>2345              123457            ABC
>2345              123458            ABC
>......
>
>what i am trying to do is select out from this table and group by a customer code but show the number of orders that customers has as well as the number of lines. So in this case the customer has 1 order and 3 lines. I thought that something like select distinct(order_num) as cust_num_of_orders would work but to no avail. anyone point me in the right direction please.
>~M
select  count(distinct Order_Num) as Orders, count(distinct Unique_Line_No) as Lines, 
Customer_Code from CustomerOrders group by Customer_Code
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform