Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL - How Do I Do This?
Message
De
22/07/2002 18:52:24
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00681371
Message ID:
00681395
Vues:
12
>I have a header/lineitem problem.
>
>The header table has the following fields:
>RecordId   DocId    RevNum
>------------------------------------
>       1    0001         3
>
>
>The LineItems has:
>
>RecordId   ParentId   LineId    RevNum   OrigRev  RecType
>------------------------------------------------------------
>    1          0001      123         1       999        I
>    2          0001      123         2       999        I
>    3          0001      123         3       999        A
>    4          0001      890         1       999        I
>    5          0001      890         2       999        A
>
>
>
>I need to pull all active record (RecType = "A") and the record
>which was active just prior to the currently active record.
>
>So in the example above, if I wanted to see the active line item
>and previous record for line item 123, I would get the line items
>record Id's with 3 and 2.
>
>Any ideas?

You might need to do this one procedurally. At least one potential gotcha I can see is that there may not be any earlier RevNum or Inactive RecType for a given LineId.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform