All pastes #523959 Raw Edit

mrgenixus

public sql v1 · immutable
#523959 ·published 2007-05-30 23:11 UTC
rendered paste body
SELECT count (*) FROM (coupon.id AS CID,                  coupon.name AS name,                  UNIX_TIMESTAMP(coupon.effective) AS effective,                  UNIX_TIMESTAMP(coupon.expiration) AS expiration,                  coupon.id AS x,                  ( SELECT ( ( SELECT count( * )  FROM `vote_coupon` WHERE vote_coupon.coupon_id = x ) * .75 ) + ( ( SELECT ( 30 - ( to_days( expiration ) - to_days( now() ) ) )                    FROM `coupon`                    WHERE ( expiration - now() ) <= 30                      AND coupon.id = x                    GROUP BY coupon.id )  * .15 ) + ( ( SELECT count( * ) FROM `access` WHERE access.coupon_id = x ) * .10 ) ) AS score                FROM `coupon` , `subcategory` , `category` , `business`                WHERE coupon.effective <= now()                        AND coupon.expiration >= now()                        AND (SELECT (coupon.flags ^ 1)) #ACTIVE                GROUP BY coupon.id                HAVING score > 4.20                LIMIT 0,10                ) v1gives: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*) FROM (coupon.id AS CID,                  coupon.name AS name,              ' at line 1