Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Avoiding redundant data in a view
Message
De
28/12/2003 08:46:36
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
28/12/2003 07:19:45
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00862327
Message ID:
00862340
Vues:
15
What do you need this for?

For example, if it is for a report, you can simply omit repeated values in the report field options.

>I have a view that includes parent child relations.
>
>The following sql statement duplicates Cms (the parent) data if there are more than one Items (child) records.
>
>In this scenario, how can the statement be changed so that parent (cms) information is shown only once when there are multiple child records? In other words, nulls would appear in the cms part of the view for the second, third, fourth, etc. child records. Thanks in advance!
>
>SELECT DISTINCT Cms.order, Cms.custnum, Cms.odr_date, Cms.paymethod,;
> RIGHT(ALLTRIM(Cms.cardnum),4), Cms.exp, Cms.approval, Items.order,;
> Items.item, Items.inpart, Items.quanto, Items.quantf, Items.quantb,;
> Items.quantp, Items.quants, Items.discount, Items.picked, Items.desc,;
> Items.item_state, Items.ponumber, Box.order, Box.box, Box.status,;
> Box.trackingno, Invoice.order, Invoice.inpart, Invoice.custnum,;
> Invoice.shipping, Invoice.ship_date, Invoice.inv_date, Invoice.amt_paid,;
> Invoice.amount, Invoice.stax;
> FROM ;
> export!cms ;
> INNER JOIN export!items ;
> ON Cms.order = Items.order ;
> INNER JOIN export!box ;
> ON Cms.order = Box.order ;
> INNER JOIN export!invoice ;
> ON Cms.order = Invoice.order;
> WHERE NOT (EMPTY(Items.item) );
> ORDER BY Cms.order, Items.item
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)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform