MySQL UPDATE with INNER JOIN and Subquery Optimisation

Posted on January 10th, 2012 by admin
Filed under MySQL | No Comments

Recently working on a project I discovered and learnt something new so I thought I would share it amongst everyone.

I had to replace data from one column of a database table to the other database table overwriting it’s column data. The key also was it’s optimisation as I was dealing with 10,000 products. So anyone intending to use it for tables holding big data this may help!

Here is the query:

UPDATE table1 AS t1
INNER JOIN
(SELECT item_code, image FROM table2 WHERE some_type=’name’) AS t2
ON (t2.item_code=t1.item_code)
SET t1.image = t2.image

As simple as that.

Steve Perkins

Remove WordPress tags from header

Posted on August 2nd, 2011 by admin
Filed under Wordpress | No Comments

Within the Wordpress head tags it can be quite messy. So here is some code to get rid of unwanted tags within the HTML tag.

iPhone iOS 4.1 password security unlock flaw

Posted on October 26th, 2010 by admin
Filed under Articles | 2 Comments

Hi to all that have an iPhone 4 running iOS 4.1 or who are planning to buy one We recently discovered a security flaw with the iPhone 4 despite having a lock code. This is a major security issue, which allows you to access the contacts section without having to unlock the 4 digit lock [...]

New Website – Blue Elephant Telford

Posted on December 7th, 2009 by admin
Filed under Articles | 2 Comments

Another new website for the month; Blue Elephant in Telford is a new Contemporary Indian Cuisine in Telford. The beauty about this website is that it’s connected to our Admin Control Panel making it a Content Management System (CMS). The deadline for this website was 29/11/2009 but the Viable Web Design team had this finished [...]

New Website – Spice Lounge Telford

Posted on December 7th, 2009 by admin
Filed under Articles | No Comments

Another new website for the month; Spice Lounge in Telford is amongst the top Telford Indian Restaurant. The beauty about this website is that it’s connected to our Admin Control Panel making it a Content Management System (CMS). The deadline for this website was 01/12/2009 but the Viable Web Design team had this finished on [...]

New Website – 2nd City Driving School

Posted on December 7th, 2009 by admin
Filed under Articles | 2 Comments

Our dedicated team of website designers / website developers have created a new website for 2nd City Driving School in Birmingham, West Midlands. All our work is agreed to the user specification and the 2nd City staff were really impressed with the JQuery pulldown and the way certain functionality of the website was achieved. We [...]

How to compare two dates in php

Posted on December 6th, 2009 by admin
Filed under PHP, Tutorials | No Comments

Now that we know how to convert a formatted date in PHP to timestamp. Let’s move on to compare two dates. At my workplace I came across and instance where I had to check the posted date wasn’t less than today’s date, so let’s put this in picture so you know the concept behind date [...]

How to convert a date into a timestamp

Posted on December 5th, 2009 by admin
Filed under PHP, Tutorials | 1 Comment

Whether you are posting a date or a passing variable that is a formatted date you can use the function below to convert it into a timestamp function convert_timestamp($delimeter,$date){ $explode_date = explode($delimeter,$date); $new_date = mktime(0,0,0,$explode_date[1],$explode_date[0],$explode_date[2]); return $new_date; } Now to test the function we have created is shown below. $date = “01/12/2009″; $delimeter = “/”; [...]