mysql:通过传递多个值从多个表中获取数据的组合
在我的数据库中。我有三张表:分类表、位置表和分类表 对于每一列,数组中都有一些值mysql:通过传递多个值从多个表中获取数据的组合,mysql,database,sails.js,mysql-workbench,rdbms,Mysql,Database,Sails.js,Mysql Workbench,Rdbms,在我的数据库中。我有三张表:分类表、位置表和分类表 对于每一列,数组中都有一些值 location:['delhi','mumbai','goa','chennai'] Category:['Teacher','Student','Managment'] classification:['expert','normal'] 现在我想从表中获取数据的组合 我正在为此使用存储过程 以前我只有一个位置、一个类别和一个分类,所以我使用以下方法: FROM user u1, serviceprov
location:['delhi','mumbai','goa','chennai']
Category:['Teacher','Student','Managment']
classification:['expert','normal']
现在我想从表中获取数据的组合
我正在为此使用存储过程
以前我只有一个位置、一个类别和一个分类,所以我使用以下方法:
FROM user u1, serviceprovider s1, city c1
WHERE s1.userId = u1.id
AND c1.cityId = s1.city
AND s1.serviceProviderId IN
(SELECT DISTINCT serviceprovidecategoryr_cl AS serviceProviderId
FROM Db.serviceprovider_cl__serviceproviderclassification_classification t1
INNER JOIN Db.location_servicelocation__serviceprovider_locationid t2 ON t1.serviceprovider_cl = t2.serviceprovider_locationId
INNER JOIN Db.category_serviceprovidercategory__serviceprovider_category t3 ON t2.serviceprovider_locationId = t3.serviceprovider_category
WHERE
t1.serviceproviderclassification_classification IN
(SELECT serviceProviderClassificationId
FROM serviceProviderClassification sp
WHERE sp.name = classification)
AND t2.location_serviceLocation IN
(SELECT locationId
FROM location
WHERE shortAddress = location)
AND t3.category_serviceProviderCategory IN
(SELECT categoryId
FROM category
WHERE categoryName = category)
);
END
但是现在我得到了多个值,那么如何修改这个存储过程呢
如果还有其他的好方法
请帮忙