John, > I know I could very easily do this after doing the > initial database call simply by calculating the two > variables, but, I was wondering if there was a way to > do this during the sql statement so my results would > already have my answer... > > Here's the setup. I have two tables. Table A has the > information about a mailing. Table B has an individual > record for each click generated by the e-mail. > > They look like this: > > TableA > ID // unique identifier > mail_date > mail_qty // shows how many mails were sent > > > TableB > ID // unique identifier > mail_ID // matches up with the ID in Table A > mem_ID // the member's unique code > > Here is what I thought was going to work (but didn't): > > SELECT mail_date, mail_qty, count(*) as clicks, > ((clicks / mail_qty)*100) as percentage FROM TableA, > TableB WHERE mail_ID = TableA.ID GROUP BY mail_ID > > What I was hoping to get back was something like this: > > | mail_date | mail_qty | clicks | percentage | > | 2001-02-05 | 1000 | 100 | 10 | > > If I need to do this the long way, it's not a huge > deal, but, I thought this may be something I could > do... > > I hope I explained that good enough. Thanks for your > help!
If the "clicks" is removed from the formula, and replaced with "count(*)" does that solve the problem? Let us know! =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php