Page 2 of 2

Re: Adding all tables together?

Posted: Sat Oct 16, 2010 4:54 pm
by robynprivette
I know how many entries are in there... I want to show it to other people who use my site.

Re: Adding all tables together?

Posted: Sat Oct 16, 2010 6:12 pm
by McInfo
robynprivette wrote:i don't know how to do that
Does that mean you do have phpMyAdmin? There is a tab in phpMyAdmin where you can run SQL queries.
screenshot.png
screenshot.png (29.04 KiB) Viewed 223 times
robynprivette wrote:I know how many entries are in there
Do you need a SUM to get a total of the values or a COUNT to get the number of rows?

Re: Adding all tables together?

Posted: Sat Oct 16, 2010 6:21 pm
by robynprivette
yes i have phpmyadmin. i need the sum to get a total of all the values

Re: Adding all tables together?

Posted: Sat Oct 16, 2010 10:07 pm
by McInfo
If you paste the queries from your script into phpMyAdmin, do you get the expected results?

Try the query I gave you before (repeated here). Do you get the expected result?

Code: Select all

SELECT
    (a.sum + b.sum + c.sum) AS total
FROM
    (SELECT SUM(code) AS sum FROM egg  ) AS a,
    (SELECT SUM(code) AS sum FROM hatch) AS b,
    (SELECT SUM(code) AS sum FROM er   ) AS c

Re: Adding all tables together?

Posted: Sat Oct 16, 2010 10:12 pm
by robynprivette
No I get this 1e+19

Re: Adding all tables together?

Posted: Sun Oct 17, 2010 12:47 am
by McInfo
In phpMyAdmin,
  1. Click the Database: ... link at the top of the page.
  2. Click the Export tab.
  3. Uncheck everything except SQL and Structure (and None because it cannot be unchecked).
  4. Click the Go button.
  5. Copy-and-paste the CREATE TABLE statements in a reply.
I'm interested in the data types of the code fields.