RE: [PHP-DB] Multiple SQL queries...? - SOLVED

2004-06-04 Thread Tristan . Pretty
Finally got it! Cheers for all your help... it was the group by Emial that was the clincher... I didn't know that it acted like distinct() Live and learn...! Cheers everyone! Gavin Amm [EMAIL PROTECTED] 04/06/2004 00:16 To [EMAIL PROTECTED] cc Subject RE: [PHP-DB] Multiple SQL queries

Re: [PHP-DB] Multiple SQL queries...?

2004-06-03 Thread Daniel Clark
Is this what you want ?? $sql = SELECT DISTINCT(email) FROM $table; $result = mysql_query($sql,$connection) or die(Couldn't execute query 0.); $row1 = 0; while ($row = mysql_fetch_array($result)) { echo $row[email] ; $sql1 = SELECT * FROM $table WHERE viewed = '1' AND

Re: [PHP-DB] Multiple SQL queries...?

2004-06-03 Thread Tristan . Pretty
PROTECTED] [EMAIL PROTECTED] cc Subject Re: [PHP-DB] Multiple SQL queries...? Is this what you want ?? $sql = SELECT DISTINCT(email) FROM $table; $result = mysql_query($sql,$connection) or die(Couldn't execute query 0.); $row1 = 0; while ($row = mysql_fetch_array($result

Re: [PHP-DB] Multiple SQL queries...?

2004-06-03 Thread Bobo Wieland
[EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, June 03, 2004 4:43 PM Subject: Re: [PHP-DB] Multiple SQL queries...? Kinda, but I just wanna count how many views in total... Hence my $row1++; bit... I'll have a play with your code though...! Cheers, Tris... Daniel Clark [EMAIL

Re: [PHP-DB] Multiple SQL queries...?

2004-06-03 Thread Daniel Clark
OK, how about this? $sql = SELECT DISTINCT(email) FROM $table; $result = mysql_query($sql,$connection) or die(Couldn't execute query 0.); while ($row = mysql_fetch_array($result)) { echo $row[email] ; $sql1 = SELECT * FROM $table WHERE viewed = '1' AND email = '$row[email]';

Re: [PHP-DB] Multiple SQL queries...?

2004-06-03 Thread Tristan . Pretty
] [EMAIL PROTECTED] Subject Re: [PHP-DB] Multiple SQL queries...? OK, how about this? $sql = SELECT DISTINCT(email) FROM $table; $result = mysql_query($sql,$connection) or die(Couldn't execute query 0.); while ($row = mysql_fetch_array($result)) { echo $row[email] ; $sql1

Re: [PHP-DB] Multiple SQL queries...?

2004-06-03 Thread Daniel Clark
Not tested... how about something like this? SELECT t1.email, t2.count(*) FROM $table t1 LEFT JOIN $table t2 ON (t1.email = t2.email and t2.viewed = '1') GROUP BY EMAIL Nope... HHmmm, this is really getting to me... I can do distinct, I can count, but I can't combine the two? Can't be that

RE: [PHP-DB] Multiple SQL queries...?

2004-06-03 Thread Gavin Amm
Have you tried - GROUP BY email - ? Nope... HHmmm, this is really getting to me... I can do distinct, I can count, but I can't combine the two? Can't be that hard ;-) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database