bradrob
Starting Member
United Kingdom
14 Posts |
Posted - February 24 2012 : 02:13:30
|
Hi
Just a quick question i would like a little help with if anyone has a simple answer, all i want to do is select all products from the products table for a particular categoryid and also products for a highercatalogid match so that it will display all of the products from one category and sub categories below it.
so first i would need to query the categories table for any categories that have a highercategoryid the same as the category you are loading, and then query the products table for the 2 different categoryid (the main cat and subcat) and display all products as normal.
i found a tutorial on the internet for an SQL subquery statement but i'm not sure whether this will accomplish what i need, this is the sample they give.
SELECT id, first_name FROM student_details WHERE first_name IN (SELECT first_name FROM student_details WHERE subject= 'Science');
Would anybody know if this could do the job.
Thanks Brad |
|
diegomilito
VP-CART Expert
  
Argentina
779 Posts |
Posted - March 10 2012 : 05:07:54
|
select * from products a, categories b where a.ccategory = 10 and a.ccategory = b.categoryid
this is example to get list of products that have category id 10.
could be something like this to display the products frm main cat.
Diego. |
 |
|
carfin
VP-CART Expert
  
United Kingdom
948 Posts |
Posted - April 02 2012 : 09:03:00
|
or use the prodcategories table to get the all the products listed for any categories that you want:
SELECT DISTINCT intcatalogid AS catalogid FROM prodcategories WHERE intcategoryid IN (10,53,101,127..... etc)
Regards,
Carrol www.deanston-electrical.co.uk |
 |
|
|
Topic  |
|