Welcome Guest, Not a member yet? Register   Sign In
Need help for complex query
#1

(This post was last modified: 10-10-2020, 03:26 PM by webdevron.)

I have a product table, category table and another table to join product and category where category stored in JSON format. What I need to do is to get all the product with a list category IDs.

Category table

Code:
-----------------------
| id | category_name
-----------------------

Product table

Code:
-----------------------
| id | product_title
-----------------------

Product Category relation table

Code:
-----------------------
| product_id | categories [varchar(100) but data stored in JSON format]
-----------------------
| 1          | [1,4,6]
-----------------------
| 2          | [34,8,9]
-----------------------
| 2          | [27,18,29]

According to example, what will be the query if I need to get all the product with the category list (array)[34,18,6]

I will be very glad if you suggest any better table structures. Thanks in advance.  Shy
"Who thinks in code"
Perfectly describes who I am
mbparvez.me
Reply


Messages In This Thread
Need help for complex query - by webdevron - 10-10-2020, 03:24 PM
RE: Need help for complex query - by nc03061981 - 10-10-2020, 09:46 PM
RE: Need help for complex query - by nc03061981 - 10-11-2020, 01:19 AM
RE: Need help for complex query - by T.O.M. - 10-11-2020, 11:50 PM



Theme © iAndrew 2016 - Forum software by © MyBB