# MY SQL Query help



## VividProfessional (Apr 29, 2009)

Hi all,
As my project gathers pace I have noticed that some users are inputting Aircraft Models (field is "model") as - 

737-8AS
737-8k3
757-222
etc

What I want to do via a query is to run through these and add a leading "B", for instance the above would be changed to:

B737-8AS
B737-8k3
B757-222

What I have in my daily update line is - 


```
UPDATE `spotting` SET `model`='B737-*' WHERE `model` = '737-*';
```
this doesnt appear to be picking them up, and the "simulate query" also returns 0 rows when i know full well there are (I put some in to test).

Where am I going wrong?

the first few lines of my daily update script is as follows:

```
UPDATE `spotting` SET `model`='B737-8AS/W' WHERE `model` = 'B737-8AS';
UPDATE `spotting` SET `model`='B737-8K5/W' WHERE `model` = 'B737-8K5';
UPDATE `spotting` SET `model`='B737-%' WHERE `model` = '737-%';
UPDATE `spotting` SET `operator`='United States Airforce' WHERE `operator` = 'US Airforce'
```
Everything else appears to be working fine


----------



## VividProfessional (Apr 29, 2009)

so this doesnt work either 

```
/* Set Boeings */
UPDATE `spotting` SET `model`='B707-%' WHERE `model` LIKE '707-%';
UPDATE `spotting` SET `model`='B717-%' WHERE `model` LIKE '717-%';
UPDATE `spotting` SET `model`='B727-%' WHERE `model` LIKE '727-%';
UPDATE `spotting` SET `model`='B737-%' WHERE `model` LIKE '737-%';
UPDATE `spotting` SET `model`='B747-%' WHERE `model` LIKE '747-%';
UPDATE `spotting` SET `model`='B757-%' WHERE `model` LIKE '757-%';
UPDATE `spotting` SET `model`='B767-%' WHERE `model` LIKE '767-%';
UPDATE `spotting` SET `model`='B777-%' WHERE `model` LIKE '777-%';
UPDATE `spotting` SET `model`='B787-%' WHERE `model` LIKE '787-%';
```
It does edit the data to give the leading "B" but it then drops every after the B737-xxx

where "737-8AS/W" becomes "B737-"


----------

