Kolomnamen achterhalen (MySQL): verschil tussen versies
Naar navigatie springen
Naar zoeken springen
Regel 21: | Regel 21: | ||
* http://stackoverflow.com/questions/11835155/mysql-split-comma-separated-string-into-temp-table | * http://stackoverflow.com/questions/11835155/mysql-split-comma-separated-string-into-temp-table | ||
+ | * http://stackoverflow.com/questions/29161921/split-a-comma-spearated-string-to-a-table-in-mysql?lq=1 |
Versie van 11 mei 2016 11:40
Kolomnamen achterhalen is simpel
select column_name from information_schema.columns where table_name="tabelnaam" and table_schema="databasenaam";
Of wegschrijven in een tijdelijke tabel:
drop table if exists tmp; create temporary table tmp select column_name from information_schema.columns where table_name="tabelnaam" and table_schema="databasenaam";
Kolomnamen naar één record wegschrijven
Maar nu wil ik de namen naar verschillende velden in één record in een tabel schrijven, bv. om deze veldnamen als heading te gebruiken. Liefst zonder de kolomnamen te moeten benoemen.