Hi, I am in trouble for getting related product. Any idea to implement it with SQL?

For Example:
Main Product Name: ABC Shirt B190 Men

The sql will show the related product like
ABC Shirt B190 Women
ABC Shirt B190 Child

Following up on what pritaeas said, you would either need to select one or create a new column that represents "relationship" between different products.

This could be done a few different ways. For example, you can have two columns called shirt_name and shirt_type, that way you can have "ABC Shirt" listed in shirt_name and "Men, Women, Child" listed as shirt_type in different rows, and depending on whether the user is on a page viewing any "ABC Shirt", the query can get all shirt_name column items with that name.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.