writing an inner join statement

Posts   
 
    
Posts: 6
Joined: 04-Mar-2010
# Posted on: 09-Mar-2010 10:11:18   

I've got a question on retreiving data from sql database using inner joins.

here are the tables I'll retreive data from in the database:

pc_products -numeric data (like id, price, tax etc.) pc_detail_products -details (like name and info) phone_products -numeric phone_detail_products -details

(both pc and phone product tables have the same fields. the detail_product tables have the same properties as well.) **_ the result i need is, combination of some phone and pc products with joining their details from the xx_detail_products tables_**

normally i'd do this with sending the catalog name in a @catalog parameter, but i have no idea how this should be done using Llblgen.

I'd appreciate if you give some sample codes since i'm just a beginner to this.

thanks in advance.

Walaa avatar
Walaa
Support Team
Posts: 14994
Joined: 21-Aug-2005
# Posted on: 09-Mar-2010 10:46:08   

You will have 2 issue 2 database calls for each Products table. Unless you have a database View that unions both.

As for the details, you didn't specify whether you want their data to be fetched products table in one set (flat results sets). Or you 'dlike to fetch them in graph like results (Product.Details like).

Posts: 6
Joined: 04-Mar-2010
# Posted on: 09-Mar-2010 11:15:50   

actually i have union but i'm not gonna use that because i have too many catalogs in the view of unions. it drastically decrease the performance.

i need the data fetched in one set. all data from the four tables must be in the same datasource of the grid i'd like to show.

for example, one customer has 2 pc and 3 phone orders, and he or she would like to display the order details.

Walaa avatar
Walaa
Support Team
Posts: 14994
Joined: 21-Aug-2005
# Posted on: 09-Mar-2010 11:32:02   

You'll need to use the Designer to create a TypedList, or use a DynamicList created in code.

Posts: 6
Joined: 04-Mar-2010
# Posted on: 09-Mar-2010 11:54:44   

thanks for the info, i'll check that.