newbie - linking queries with dynamic where conditions
Hi- I am trying to write a sql query that will output (domain, transport, sum(count), sum(size)) from multiple tables for many records. When the domain field is dynamic based on the adminId passed to the query, how do I execute the second query at the same time? Thanks in advance, Max select a.domain, a.transport from transport as a, acl as b where a.id=b.transportId and b.adminId='1'; select sum(count), sum(size) from stats where email like '%a.domain'; - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: newbie - linking queries with dynamic where conditions
So I am trying to accomplish something like this: select a.domain, a.transport, sum(c.recipient_count) sum(c.recipient_size) from transport as a, acl as b, recipientstats as c where a.id=b.transportId and b.adminId='1' and c.recipient_email like '%a.domain'; But I know I am missing something because of the error. Can anyone point me in the right direction? Thanks in advance, Max Max Clark [EMAIL PROTECTED] wrote in message ataq2r$ev1$[EMAIL PROTECTED]">news:ataq2r$ev1$[EMAIL PROTECTED]... Hi- I am trying to write a sql query that will output (domain, transport, sum(count), sum(size)) from multiple tables for many records. When the domain field is dynamic based on the adminId passed to the query, how do I execute the second query at the same time? Thanks in advance, Max select a.domain, a.transport from transport as a, acl as b where a.id=b.transportId and b.adminId='1'; select sum(count), sum(size) from stats where email like '%a.domain'; - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: newbie - linking queries with dynamic where conditions
You´re missing the GROUP BY clause select a.domain, a.transport, sum(c.recipient_count) sum(c.recipient_size) from transport as a, acl as b, recipientstats as c where a.id=b.transportId and b.adminId='1' and c.recipient_email like '%a.domain' GROUP BY a.domain,a.transport; -Original Message- From: news [mailto:[EMAIL PROTECTED]] On Behalf Of Max Clark Sent: Thursday, December 12, 2002 5:30 PM To: [EMAIL PROTECTED] Subject: Re: newbie - linking queries with dynamic where conditions So I am trying to accomplish something like this: select a.domain, a.transport, sum(c.recipient_count) sum(c.recipient_size) from transport as a, acl as b, recipientstats as c where a.id=b.transportId and b.adminId='1' and c.recipient_email like '%a.domain'; But I know I am missing something because of the error. Can anyone point me in the right direction? Thanks in advance, Max Max Clark [EMAIL PROTECTED] wrote in message ataq2r$ev1$[EMAIL PROTECTED]">news:ataq2r$ev1$[EMAIL PROTECTED]... Hi- I am trying to write a sql query that will output (domain, transport, sum(count), sum(size)) from multiple tables for many records. When the domain field is dynamic based on the adminId passed to the query, how do I execute the second query at the same time? Thanks in advance, Max select a.domain, a.transport from transport as a, acl as b where a.id=b.transportId and b.adminId='1'; select sum(count), sum(size) from stats where email like '%a.domain'; - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php