Need help with a query and subsequent output

Did you try my variation?
Can you post your query with the JOIN?
And can you post the error it’s giving you?

here is the query:

SELECT certnumbers.setdescription , COUNT() AS qty , AVG(certnumbers.grade) AS avgcond, , (COUNT() / sets.setqty) * 100 AS pcomp FROM certnumbers INNER JOIN sets ON certnumbers.setdescription = sets.item AND certnumbers.sport = sets.sport GROUP BY certnumbers.setdescription

This is the error:

Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource in /usr/local/psa/home/vhosts/verisleeve.com/httpdocs/admin/mysql_send-4.php on line 28

I got it working…

SELECT
certnumbers.setdescription
, COUNT() AS qty
, AVG(certnumbers.grade) AS avgcond
, (COUNT(
) / sets.setqty) * 100 AS pcomp
FROM certnumbers
INNER JOIN sets
ON certnumbers.setdescription = sets.setdescription
AND certnumbers.sport = sets.sport
GROUP BY
certnumbers.setdescription

Now to add a where clause and add to the php output!

In the certnumbers table I have a column called owner. I’m having issues getting a where clause to work as follows:

SELECT
certnumbers.setdescription
, COUNT() AS qty
, AVG(certnumbers.grade) AS avgcond
, (COUNT(
) / sets.setqty) * 100 AS pcomp
FROM certnumbers
WHERE owner=ekramer
INNER JOIN sets
ON certnumbers.setdescription = sets.setdescription
AND certnumbers.sport = sets.sport
GROUP BY
certnumbers.setdescription

SELECT
certnumbers.setdescription
, COUNT(*) AS qty
, AVG(certnumbers.grade) AS avgcond
, (COUNT(*) / sets.setqty) * 100 AS pcomp
FROM certnumbers
INNER JOIN sets
ON certnumbers.setdescription = sets.setdescription
AND certnumbers.sport = sets.sport
WHERE owner='ekramer'
GROUP BY
certnumbers.setdescription

You really should study the syntax a bit more :slight_smile:

By the way, this error

Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource in /usr/local/psa/home/vhosts/verisleeve.com/httpdocs/admin/mysql_send-4.php on line 28

only indicates that your query has gone wrong.
To know what went wrong, use this construction:


$result = mysql_query($query) or die(mysql_error());

That works! I had the quotes in my query… i just had it in the wrong place.

I’m learning and this site and users has been a tremendous help!