|
|
|
All SQL "tutorials" on the web seem to gloss over one thing:
inserting non-literal values into a table. It took me
days to discover that this is the correct syntax for
inserting values based on a SELECT from another table:
INSERT INTO systems_to_devtools
SELECT systems.id,devtools.id
WHERE systems.hostname='fnargle'
AND devtools.vendor='Gnu'
AND devtools.name='C++';
Another key thing here is to know the order of your columns.
|
|
| explode() and SQL blobs Categories : General SQL, Strings, PHP, Databases | | | Point and Click Interface ala MS Access for creating SQL statements. Categories : MySQL, Complete Programs, General SQL, PHP, Databases | | | phpEasySQL - Easily connect to your MySQL database with just 1 php file and 3 easy steps! Categories : Databases, PHP, MySQL, General SQL | | | Is there some possibility to link a database to an htaccess file, so that instead of having a passwd file you would have a database with DES-crypted password and username fields? Categories : Authentication, PHP, General SQL, Databases | | | Sql Builder Categories : PHP, HTML and PHP, Databases, General SQL, Form Processing | | | Logs hits to any page which includes it. Automatically utilises page access information left behind by PHP/FI2.0. Categories : Databases, PHP, mSQL, Databases | | | This function will populate the options in a drop down HTML select list
in a form from a database query.
Categories : MySQL, General SQL, PHP, HTML and PHP, Databases | | | I`d like to use the mysql_fetch_row function along with a "randomizer"
function that would give me a random result from a mySQL table. Categories : General SQL, MySQL, PHP, Databases | | | google like search function with bolded search terms Categories : PHP, Search, Databases, General SQL | | | You have a set of many resources , and You need to know wich of these resources are available for a given use during a given period but MySql does not allow SUB-Selection :(
here is the right way to do that in a single query
Categories : MySQL, General SQL, Databases, Algorithms | | | TSQL INDENTER Categories : MS SQL Server, Debugging, Databases, General SQL | | | This is a class with functions that are taken from simple SQL statements.
I made it to have an easier connection between PHP3 and DBase files. Categories : General SQL, PHP, PHP Classes, Databases | | | Persistent connections - General information. Categories : General SQL, PHP, Databases | | | This program allows you to upload an ODBC ressource - i.e. an MS-Access database to a MySQL server. Categories : Databases, MySQL, Complete Programs, PHP, Databases | | | Dynamic WHERE CLAUSE depending on number of FORM FIELDS Categories : ODBC, General SQL, PHP, Complete Programs, Databases | |
| | | | Laurent Picquet wrote :76
a more generic aproach could be:
insert into table_a (column_a,column_b)
select column_c,column d
from table_b
where column_c=`litteral_1`
and column_d=`litteral_2`
order by 1,2;
| |
|
|
|