Welcome Guest, Not a member yet? Register   Sign In
using phpMyAdmin to create temp tables

(This post was last modified: 08-25-2020, 09:17 AM by richb201.)

I am planning on using phpMyAdmin to write stored procedures. What I am doing in the stored procedure is creating a temporary table  called "A" and then within my CI application I will access A and generate reports. The problem is 1) I don't know how to save the SP with phpMyAdmin and 2) how can I view the table that was created within phpMyAdmin? I don't see it as being added to the Tables in phpmyAdmin.
proof that an old dog can learn new tricks


What version of phpMyAdmin are you using? Also, depending on where you host it are you sure you will have full access to all phpMyAdmin features? A search on Google would definitely give you the answer that you seek.

Thx php. I did search prior to posting this. My phpMyAdmin is 5.0.1 and is running inside Docker on my PC.
proof that an old dog can learn new tricks

Google is your friend.

Create and Execute Stored Procedure in PHPMyAdmin
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )


Were you able to find an answer to your question? Just making sure you found a solution.

(This post was last modified: 08-30-2020, 07:50 AM by richb201.)

Thx php. While playing with this I broke the whole application and spent Sat trying to fix it. I now have a consultant looking at it. I am moving away from stored procedures due to not having a decent way to debug one. I think that using subqueries might work for me but am having trouble with that too!

SELECT risk, SUM(w2_wages) FROM employees WHERE (SELECT risk FROM titles WHERE employee_title=title)

Here I have a list of all the employees for a company with their w2_wages and their employee_title as columns. I have a second table called titles that has a column called title and another column call risk. What I want is to total the wages for each risk category, either low, med, or high. This is what i want to end up with.  Basically, the titles tables doesn't have any wage information in it. I am trying to total the wages in the employees table for each risk category.  title and employees_title are the indexes. 

risk              SUM(w2_wages)
low               2000
med             10000
high             90000

I typed this into phpMyAdmin and can run it but I don't get any result. What I get is: 

risk              SUM(w2_wages)
NULL          NULL

I know that some of the wages are NULL but how do I protect against that and why does only one row show?
proof that an old dog can learn new tricks

I got it working using this:

SELECT t.risk, SUM(e.w2_wages) as total_wages
FROM employees e
JOIN titles t ON e.employee_title=t.title
GROUP BY risk;

Someone on the mySQL forum recommended using JOIN ON. I will need to learn that trick. I would normally code the JOIN line as a WHERE e.employee=t.title and add in tables t on the FROM line.
proof that an old dog can learn new tricks

(This post was last modified: 11-11-2020, 11:39 AM by php_rocs.)

temporary table is created by using CREATE TEMPORARY TABLE statement. · MySQL removes the temporary table automatically when the session ends or the ...

Theme © iAndrew 2016 - Forum software by © MyBB