Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT p.id
- , p.title
- , a.country
- , p.total
- FROM products p
- JOIN product_tags pt
- ON p.id = pt.product_id
- JOIN address a
- ON p.address_id = a.id
- JOIN product_styles ps
- ON p.id = ps.product_id
- WHERE p.allow = 'Yes'
- AND ps.styles in ('Abstract Expressionism')
- AND p.total between 500 and 10000
- AND p.title LIKE '%abstract%'
- OR pt.tags LIKE '%abstract%'
- OR a.country LIKE '%abstract%'
- OR p.subject LIKE '%abstract%'
- GROUP
- BY p.id
- SELECT DISTINCT p.id
- , p.title
- , a.country
- , p.total
- FROM products p
- JOIN product_tags pt
- ON p.id = pt.product_id
- JOIN address a
- ON p.address_id = a.id
- JOIN product_styles ps
- ON p.id = ps.product_id
- WHERE p.allow = 'Yes'
- AND ps.styles in ('Abstract Expressionism')
- AND p.total between 500 and 10000
- AND
- ( p.title LIKE '%abstract%'
- OR pt.tags LIKE '%abstract%'
- OR a.country LIKE '%abstract%'
- OR p.subject LIKE '%abstract%'
- );
- select products.id,
- products.title,
- address.country,
- products.total
- from products
- inner join product_tags on products.id = product_tags.product_id
- inner join address on products.address_id = address.id
- inner join product_styles on products.id = product_styles.product_id
- where products.allow = 'Yes' and product_styles.styles in ('Abstract Expressionism')
- and products.total between 500 and 10000
- and (products.title like '%abstract%' or product_tags.tags like '%abstract%' or address.country like '%abstract%' or products.subject like '%abstract%' )
- GROUP by products.id
Add Comment
Please, Sign In to add comment