Kategorie: SQL

SQL, UNION and correct ORDER

Just had to combine two tables month column and sort the whole thing. I had two tables like Name Month Something 201201 Else 201112 and Name Month Anything 201201 Other 201111 and I wanted (put the two tables‘ month in one column and remove duplicates): Month 201201 201112 201111 The solution was not too complicated, …


Permanentlink zu diesem Beitrag: https://techblog.steffmeister.at/sql-union-and-correct-order/

Copy SQL records

Just found myself needing a way to copy and modify SQL records in one process. I came up with the following PHP code which is rather ugly but works: // open mysql connection and stuff … // select rows you want to copy, adapt as needed $result = mysql_query("SELECT * FROM downloads WHERE pid=2"); // …


Permanentlink zu diesem Beitrag: https://techblog.steffmeister.at/copy-sql-records/