MySQL Archive

MySQL: Multiple COUNT in one query with conditions

I’m still learning some tricks about MySQL as I go along and figured how to combine multiple COUNT queries into a single query returning one resultset. I wanted to specifically count on the same column/field but each count having it’s own condition on the table and then group the results by a ‘created’ date column

MySQL: Duplicate a column/field

You may need to duplicate an existing column/field in a MySQL table with the exact same values in the new column/field as you have in the current or original column/field. First, you’ll create a new column to the table as needed: ALTER TABLE `tablename` ADD `column2` TEXT NOT NULL; Then you’ll simply execute an UPDATE

MySQL : ORDER BY numbers

In this article I will show you how to order MySQL records by numeric values (numbers, integers & floats) from the smallest to the largest number or the other way around using a MySQL ORDER BY query.

MySQL : Transfer database from server to another server

In this article, I will show you how to dump a mysql database from one server to another remote server without having to export and import your SQL structure and data. We’ll dump a database directly to another empty database on another, remote server. In order to do this, you’ll need shell access to both

WordPress Mailing List v2.0

The WordPress mailing list plugin v2.0 has been released to the public with a great set of new features. These features include : Multiple mailing lists Email scheduling Newsletter templates Automatic updates indicator Improved sidebar widget with Ajax Post/page opt-in form embedding Email queue CSV and MacOS Address book importing Excel CSV file exporting And

Countries SQL Code

I know that I was looking for the necessary SQL code to create a countries table, together with the necessary queries to insert all the available countries into this table, each with a unique ID key. So I decided to create it and I’m sharing it with the rest of you whom might need it.

MySQL : Check if field exists

Sometimes, you need to check if a field exists in a table and if it doesn’t, you need to add it to the table and ensure that its there. Below is a snippet which you can use a reference for checking whether a field/column exists in a MySQL database table. $tableFields = mysql_list_fields("databasename", "tablename"); $columns