Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. sponsors. rss.
 From: Anders Altberg
  Where is Anders Altberg?
 Uppsala
 Sweden
 Anders Altberg
 To: chandu sekhar
  Where is chandu sekhar?
 miami
 Florida - United States
 chandu sekhar
 Tags
Subject: RE: foxpro query
Thread ID: 233064 Message ID: 233075 # Views: 23 # Ratings: 0
Version: Visual FoxPro 9 Category: ODBC, ADO and OLEDB
Date: Monday, June 29, 2009 8:10:12 PM         
   


> Hello Friends,
>
> I have a table that as two fields "Productcode" & "Needlecode".
> This has many to many relationship.
> What I means is:
>
> A single productcode can have lot of needlecodes.
> A single needlecode can have lot of productcodes.
>
> What I need to generate is a report that should have by productcode with all respective needlecodes.
> I have been thinking to write a query regarding that.
> But i am not getting perfect thinking.I am totally clueless.
> Please help me.
> I will be so thankful to you.
>
> Thanks & Regards,
> Chandra0315.


You should also have a table "Products" where productcode is the unique primary key, + columns that describe each product. And a "Needles" table where the 'needlecode' is the unique primary key. So a complete data retrieval in a query would be:

SELECT * FROM Products P JOIN ProductsNeedles AS PN ON P.productcode=PN.productscode ;
 JOIN Needles AS N ON N.needlecode=PN.needlecode ;
 ORDER BY P.productcode, N.needlecode INTO CURSOR ReportData1

You can ORDER BY any columns you like.

-Anders



COMPLETE THREAD
foxpro query Posted by chandu sekhar @ 6/29/2009 6:45:59 PM
RE: foxpro query Posted by Borislav Borissov @ 6/29/2009 7:08:31 PM
RE: foxpro query Posted by chandu sekhar @ 6/29/2009 7:20:17 PM
RE: foxpro query Posted by Borislav Borissov @ 6/29/2009 7:25:19 PM
RE: foxpro query Posted by chandu sekhar @ 6/29/2009 7:55:11 PM
RE: foxpro query Posted by Anders Altberg @ 6/29/2009 8:48:51 PM
RE: foxpro query Posted by chandu sekhar @ 6/29/2009 8:07:04 PM
RE: foxpro query Posted by Cetin Basoz @ 6/29/2009 7:29:47 PM
RE: foxpro query Posted by chandu sekhar @ 6/29/2009 7:58:13 PM
RE: foxpro query Posted by Anders Altberg @ 6/29/2009 8:10:12 PM
RE: foxpro query Posted by chandu sekhar @ 6/29/2009 8:40:33 PM
RE: foxpro query Posted by Anders Altberg @ 6/29/2009 8:52:10 PM
RE: foxpro query Posted by chandu sekhar @ 6/29/2009 9:08:24 PM
RE: foxpro query Posted by Anders Altberg @ 6/29/2009 11:00:07 PM
RE: foxpro query Posted by chandu sekhar @ 6/30/2009 4:12:31 PM
RE: foxpro query Posted by Anders Altberg @ 6/30/2009 4:41:10 PM