Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

join with subquery execution error

4 views
Skip to first unread message

amvis

unread,
Dec 14, 2011, 3:27:00 AM12/14/11
to
This is i tried the query join with sub-query..i think it have some syntax error...?

select count(*)
from (
SELECT transactions.loyalty_id FROM transactions JOIN loyalties ON (transactions.loyalty_id = loyalties.id) GROUP BY transactions.loyalty_id HAVING COUNT(*)>1 where loyalties.created_at > '2011-11-02'
) as t

Thank you
vishnu

amvis

unread,
Dec 14, 2011, 3:50:08 AM12/14/11
to
yes i got it. That was the problem with where clause position



select count(*)
from (
SELECT transactions.loyalty_id FROM transactions JOIN loyalties ON (transactions.loyalty_id = loyalties.id) where loyalties.created_at > '2011-11-02' GROUP BY transactions.loyalty_id HAVING COUNT(*)>1
) as t

"Álvaro G. Vicario"

unread,
Dec 14, 2011, 4:24:04 AM12/14/11
to
When a query has a syntax error, MySQL will tell you so. Run the query
and read the error message if any.



--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
0 new messages