Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Help Needed Please!
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00548100
Message ID:
00548204
Views:
15
>Yes, that is one way to do it. I know I could go and clean up the resulting cursor after the initial select is done also would be another way to do it. But like I mentioned in my first post, I was trying to do it only using SELECT statements.
>
>Thanks.
Ok, Here's only SQL statements solution
Select orditems.order_id, Min(Orditems.Product_id) As Product_id ;
	From OrdItems ;
	Group by 1 ;
	Order By 1 ;
	Into Cursor OI_1 Nofilter
	

Select orders.Order_id, Padr(orders.to_name, 30) As to_name , OI_1.Product_id ;
	From Orders, OI_1 ;
	Where orders.order_id = OI_1.order_id ;
Union All ;	
Select orders.Order_id, Space(30), OrdItems.Product_id ;
	From Orders, orditems ;
	Where orders.order_id = orditems.order_id ;
		And Not Exists  ( ;
		Select * ;
			From OI_1 ;
			Where OI_1.order_id = orditems.order_id  ;
				And OI_1.product_id = OrdItems.Product_id ) ;
	Order By 1 ;			
	Into Cursor cc2
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform