Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Extracting Info With Select - SQL
Message
 
 
To
29/11/2006 15:37:18
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01173495
Message ID:
01173497
Views:
7
This message has been marked as the solution to the initial question of the thread.
In your select FacturaSC.Factura refereneces the field from the current record in FacturaSC. To get all records you have to use JOIN
SET DELETED ON
Select * ;
	From Detalle1 ;
	JOIN FacturaSC ON Detalle1.Factura = FacturaSC.Factura 
UNION ALL ;
Select * ;
	From Detalle2 ;
	JOIN FacturaSC ON Detalle2.Factura = FacturaSC.Factura 
	Into Cursor tmpFacturas
>
>I have not much experience working with Select - SQL... generally, my querys can be done with a Scan...EndScan without much trouble, but this time I have something that I think Select - SQL could be of some help. For you it will be a lame question, but I'm in a trouble now and need an answer.
>
>I have a cursor in which I store some invoice numbers. Then I need to use those records in that cursor to extract the items that are relatives to those invoices. Happens that the items, for some reasons, are stored in two tables, so, I was trying something like this:
>
>Select * From Detalle1 Where Detalle1.Factura = FacturaSC.Factura .and. !Delete() Union Select * From Detalle2 Where Detalle2.Factura = FacturaSC.Factura .and. !Delete() Into Cursor tmpFacturas
>
>The resultant cursor with this sentence only shows me the items of the last invoice of the cursor (FacturaSC), but I need that the query shows me the items for every invoice in that cursor...
>
>Can somebody explain me what and how to do it?
>
>Thanks in advantage!
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform