I am trying to get the maximum count from a table but i am getting an error when i use this query.
[php]$query = “SELECT MAX FROM(SELECT type_id, COUNT(type_id) FROM activity WHERE user_id= $myid OR user_id = 3 GROUP BY type_id)”;[/php]
Can anyone help?


Takes an array and returns a string, suitable for inputing in an SQL statement

<?php function makeSQLListarray if is_Arrayarray resetarray; unsetSQL; while list,item=eacharray if is_Stringitem SQL = "" . addslashesitem . ""; else SQL = item; sql = "" . implodeSQL, ", " . ""; else sql = false; return sql; ?>


Paul, you are selecting nothing from your query. If you want the “max” of something, you still have to select some item (field)… Although, you can select just a count of items that are the “max” of something…

So, you really can not select MAX as that does not result in any type of recordset. Did that make sense?
You are actually selecting a MAX from a SELECT. Tell us what you want for a MAX and of what and then
we can help you correct the query! I think it is just a minor change in your wording…


thank you ernie. I have found a way to do it.