Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT HIGH_PRIORITY DISTINCT SQL_CALC_FOUND_ROWS t.id,
- t.product_type,
- pq.quantity,
- pq.available,
- pq.SIZE,
- pq.reserved,
- pq.reserved_auctions
- FROM towary t
- LEFT JOIN product_quantity pq ON pq.product = t.id
- WHERE in_trash = "n"
- AND t.id > "0"
- AND((t.sklep & 71) > 0)
- AND t.data_wpr >= "2012-05-01 00:00:00"
- AND t.data_wpr <= "2018-08-17 23:59:59"
- AND( ( ( t.product_type NOT IN( "product_bundle", "product_collection", "" ) )
- AND( (pq.available & 8)
- AND( ( pq.quantity - pq.reserved + pq.reserved_auctions ) > 0
- OR pq.quantity = -1 )
- AND( pq.SIZE NOT IN
- ( SELECT SIZE
- FROM auctions a
- WHERE a.product = t.id
- AND a.active = "y"
- AND a.account IN(33) ) ) ) )
- OR( ( t.product_type IN( "product_bundle", "product_collection" ) )
- AND(
- ( SELECT COUNT(*)
- FROM products_bundled_availabilities_buffer buff
- WHERE buff.bundle_id = t.id
- AND buff.stocks_type_available & 8
- AND buff.SIZE NOT IN
- ( SELECT SIZE
- FROM auctions a
- WHERE a.product = buff.product_id
- AND a.active = "y"
- AND a.account IN(33) ) ) > 0 ) ) )
- AND( t.id NOT IN
- ( SELECT DISTINCT product AS pid
- FROM auctions
- WHERE ACCOUNT IN(33)
- AND active = "y"
- AND product NOT IN
- ( SELECT DISTINCT (ps.product) AS pid
- FROM product_sizes ps
- LEFT JOIN auctions a ON ps.product = a.product
- AND ps.SIZE = a.SIZE
- AND a.account IN(33)
- AND a.active = "y"
- WHERE ps.product IN
- ( SELECT DISTINCT product AS pid
- FROM auctions
- WHERE ACCOUNT IN(33)
- AND active = "y" )
- AND a.SIZE IS NULL ) )
- AND t.version_display_panel = "y" )
- AND t.version_display_panel = "y"
- GROUP BY t.id
- ORDER BY t.id DESC ,
- t.id DESC LIMIT 0,
- 100
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement