It took three hours for the villain to stop, mysql is a mess ..................................... ..... please help me ..........................
My goal is to store the query results as a temporary table. my SQL statement is as follows:
Select a. value, a. id, B. value from a, B where a. value = B. value as k;
An error occurs ...................................... ..... what is the correct syntax ??
Both tables exist.
The corresponding field also exists.
I think there should be errors in the syntax. what is the correct syntax ??
100,000 in a hurry. thank you very much !!!!!!!!!!!!!!!!!!!!!
Reply to discussion (solution)
If an error is reported, an error message is displayed.
The error message shows the location where the problem occurs.
As k seems to have a problem. remove it and try again.
Select * from (select a. value, a. id, B. value from a, B where a. value = B. value) k;
Select * from (select a. value, a. id, B. value from a, B where a. value = B. value) k;
Still not ............ Copy it according to your statement, or an error occurs...
It should be just a statement problem. I just want to store the query results as a temporary table, which is very simple and hard to write.
If an error is reported, an error message is displayed.
The error message shows the location where the problem occurs.
Moderators help me. I just want to store the query results as a temporary table k, which is very simple.
What is your statement? paste it out and check it out.
create temporary table k select a.value,a.id,b.value from a,b where a.value=b.value
However, temporary tables can only survive in the current connection.
If an error is reported, an error message is displayed.
The error message shows the location where the problem occurs.
Moderators help me. I just want to store the query results as a temporary table k, which is very simple.
Create table temp_table as select * from table;
To create a temporary table, use create temporary table tablename to insert data.
Run phpmyadmin to view the result.
create temporary table k( `a` varchar(20) NOT NULL, `aid` int(11) NOT NULL, `b` varchar(20) NOT NULL);insert into k(a,aid,b) select a.value,a.id,b.value from a,b where a.value=b.value;select * from k;
The sentence written by the moderator needs to be changed.
create temporary table k select a.value as aval,a.id as aid,b.value as bval from a,b where a.value=b.value;select * from k;
Otherwise, there will be two values, resulting in an error. #1060-Duplicate column name 'value'
With k as (select a. value, a. id, B. value as value1 from a, B where a. value = B. value) select * from k
Or
Select * from (select a. value, a. id, B. value as value1 from a, B where a. value = B. value) k
Note that there cannot be repeated fields in select a. value, a. id, and B. value.
Not closed? What's the problem?