douyi7055 2013-07-23 16:36
浏览 10

PHP sql的多个属性

I have the folowing query that shows my products.

SELECT DISTINCT productsmap.id, attributes_product.waarde, 
attributes_product.att_id, productsmap.name, productsmap.category 
AS categoryId, brand.naam AS brand, productsmap.sku, categorie.name AS 
category, productsmap.price, productsmap.shops

FROM productsmap
INNER JOIN categorie ON productsmap.category = categorie.id
INNER JOIN brand ON productsmap.brand = brand.id
INNER JOIN attributes_product ON productsmap.id = attributes_product.pmapid

WHERE productsmap.category
IN ( 2, 3, 4, 5, 6, 7, 8 ) 
AND productsmap.shops >0
AND (
productsmap.price >= 3.94
AND productsmap.price <= 204.99
)
AND productsmap.online =1
LIMIT 0 , 30

It gives the folowing results I cropped a bit:

(id) (waarde) (att_id) (name) (categoryId) (brand) (sku) 
 2     109        1     Name       4        Merk   70000  
 2     2013       2     Name etc etc etc 
 2     123        3     Name etc etc etc 
 3     103        1     Name2  etc etc 
 3     2012       2     Name2
 3     123        3     Name2
 4     110        1     3name
 4     2013       2     3name
 4     102        3     3name

Whit multiple times the same id and name only diffrent att_id and waarde. But i need to add to my query (attributes_product.att_id = 1 and waarde = 109) and (attributes_product.att_id = 2 and waarde = 2013)

But this is not possible because it are diffrent results. How can I solve this issue? Or on what can i search to solve this issue?

It attributes.product are att_id and waarde

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度