473,388 Members | 1,177 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Create a temporary table using php

Hi guys,

i would like to make
create temporary table pagamentos SELECT d.name, SUM(advanced) AS total_advance, f.salario FROM data d JOIN empregados f ON f.name = d.name where MONTH(d.date) = 04 group by name;

and after select all

select * from pagamentos;

in a php script... could someone help me???

thanks


Danylo Iamaguchi
May 14 '07 #1
2 13553
pbmods
5,821 Expert 4TB
Moved to MySQL forum.

Are you trying to create a view?

Expand|Select|Wrap|Line Numbers
  1. CREATE VIEW pagamentos AS SELECT d.name, SUM(advanced) AS total_advance, f.salario FROM data d JOIN empregados f ON f.name = d.name group by name;
  2. SELECT * FROM pagamentos where MONTH(d.date) = 04;
  3.  
To execute this in PHP:

Expand|Select|Wrap|Line Numbers
  1. //  You'll probably want to execute this first line manually...
  2. mysql_query("CREATE VIEW pagamentos AS SELECT d.name, SUM(advanced) AS total_advance, f.salario FROM data d JOIN empregados f ON f.name = d.name group by name");
  3. mysql_query("SELECT * FROM `pagamentos` WHERE MONTH(d.date) = '04'");
  4.  
Check out this thread:
http://www.thescripts.com/forum/thread642508.html
May 15 '07 #2
thanks... i was using create table because on the mysql's shell works ok....

thanks a lot
May 15 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: maricel | last post by:
Could someone confirm which tablespace is being used when running ALTER & CREATE INDEX. Is it the tempspace or the tablespace where the table resides? Many thanks, maricel
6
by: Bruce | last post by:
I want to create a new table based on an existing table, but I don't want the tables to have any enforced relationship. Is this possible without having to do a CREATE TABLE and an INSERT? ...
3
by: Wiggy | last post by:
Hi, It's probably easiest if I describe what I'm trying to do: I have several tables I want to base a query on. In addition I have some dynamic data that I want to join against that consists...
12
by: Doug Bell | last post by:
Hi, I am having problems trying to create a (temporary) DataTable from a selection from a DataGrid (dgOrders). dtOrdDetails is declared as a Public DataTable Sub is: Dim stFilter as String...
6
by: Peter Nurse | last post by:
For reasons that are not relevant (though I explain them below *), I want, for all my users whatever privelige level, an SP which creates and inserts into a temporary table and then another SP...
0
by: santoshsri | last post by:
Can anyone tell me the sytax to create a temporary table ? Actually , I will have to store a resultset of a SQL statement into this a temporary table using select into statement. Thanks So...
2
by: prakashwadhwani | last post by:
I have an app with a Front End and a Back-End. My date field is INV_DATE I would like to copy all data with year(inv_date) 2005 to a temp table in both, the front end & the back end. How...
1
by: mpramodk | last post by:
Please find the code for creating a temporary table and access it in UDF functions. While we do this we obtain a compile time error stating "A declared temporary table cannot be used in...
9
by: DottingTheNet | last post by:
help plz!! when i try to cretae a table in a procedure like create procedure blah is begin create table..... ...... end;
3
by: DeanL | last post by:
Hi guys, Does anyone know of a way to create multiple tables using information stored in one table? I have a table with 4 columns (TableName, ColumnName, DataType, DataSize) and wanted to know...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.