Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need Help With SQL
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00579145
Message ID:
00579261
Views:
19
Do you have an ID field in LineTemp [LineItems] that would be referenced as the foreign key in the DetTemp [Details] table? If so then you can join the Details and LineItems tables on those 2 fields. Info about the structure of the LineItems table and how it is related to the Details table [what LineItems key field field value is stored in the FK field in Details table].

The join looks something like:

select .... from Details join LineItems on Details.PK = LineItems.Details_PK

>I have a table, LineItems, which is a one-to-many into Details
>
>The first SQL pulls the LineItems for my pre-determined Where
>clause and works fine.
>
>The second SQL counts records from Details which have a value in AirTime,
>into a 2 column cursor. These counts represent the total number of detail
>items, for any given line item, that are cleared
>
>I need to get the LineItems from the first cursor, 'LineTemp', and
>the counts from the second cursor, 'DetTemp', into a table.
>
>How do I do this?
>
>  SELECT *;
>    FROM LineItems;
>    WHERE &cWhere;
>    INTO CURSOR LineTemp
>
>  SELECT COUNT(DocId) AS NumCleared, BoIdBase ;
>    FROM Details ;
>    WHERE NOT EMPTY(AirTime) AND RecType = "A" ;
>    GROUP BY BoIdBase ;
>    INTO CURSOR DetTemp
>

>
>Note that both of the above SQL's do work, I just need to combine
>the results so that I see the counts as a line item field.
>
>Thanks
Mark McCasland
Midlothian, TX USA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform