Open GoogleCodeExporter opened 9 years ago
[deleted comment]
[deleted comment]
Using the mysql client, if I execute the "SELECT COUNT..." query (minus the
WHERE
clause) on the patron_types table, I get results. If I execute the same query
with
all instances of "patron" changed to "read", I get a syntax error. I must have
made
a mistake somewhere else, but I can't seem to track it down.
mysql> select count(questions.question) as questions, patron_types.patron_type
as
patrons from questions join patron_types on (questions.patron_type_id =
patron_types.patron_type_id) group by patrons;
+-----------+---------------------+
| questions | patrons |
+-----------+---------------------+
| 2144 | Community |
| 1179 | Faculty/Staff |
| 2450 | Student - Graduate |
| 23193 | Student - Undergrad |
| 1421 | Unknown |
+-----------+---------------------+
5 rows in set (0.14 sec)
mysql> select count(questions.question) as questions, read_types.read_type as
reads
from questions join read_types on (questions.read_type_id =
read_types.read_type_id)
group by reads;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'reads from
questions join read_types on (questions.read_type_id = read_types.rea' at line 1
mysql>
Original comment by cgriml...@gmail.com
on 10 Jul 2009 at 6:57
Problem solved.
MySQL doesn't like "reads" as the JOIN alias. I changed it to "readtypes" and
it all
works.
So, line 27 should look something like this:
$fullQuery = "SELECT COUNT(questions.question) as questions, read_types.read_type
as readtypes
FROM questions
JOIN read_types ON
(questions.read_type_id = read_types.read_type_id)
$sql
GROUP BY readtypes";
And line 74 should be changed to match:
<td>{$report["readtypes"]}</td>
Original comment by cgriml...@gmail.com
on 10 Jul 2009 at 7:09
Original issue reported on code.google.com by
cgriml...@gmail.com
on 9 Jul 2009 at 8:52Attachments: