Just possibly this query more rightly belongs on a MySQL forum, but rather than going to all the trouble necessary for me to join yet another support site, I thought I might post a query here.
Besides, it arises from my attempt to upgrade a very old version of Drupal (4.x I think). I am trying to see what tables are updated when I update the content of a Drupal 6.x web-site in various ways -- adding a node, adding a comment, adding a tag, changing the menu, etc. This will help me to understand how to import my older web-site into Drupal version 6.x .
So I need to count the rows in each table before and after the change. Where the row counts differ, that table has been updated.
To store the data, I create another table, rowcount:
drop table rowcount;
create table rowcount(tname varchar(64), f1name varchar(64), rcount integer);
... Then, for each table, I find out the row count for each table and store it together with the table name and and the name of a field or column[1] in the table:
INSERT INTO rowcount (tname, f1name, rcount) VALUES ("access", "aid", select COUNT(*) from `access`);
The above SQL statement does not work, even though the SQL statement contained in the above INSERT statement:
select COUNT(*) from `access`
... does work. The error I get is the following: