I have a license
table that contains the type
of license and the license number
. The user was supposed to type in the entire license number (including type and number) as shown on their license. I inherited a database with some who followed the rules and some who did not. See the table below for samples.
type | number |
---|---|
RN | 2676612 |
PN | 1234567 |
RN | RN2676612 |
PN | PN1234567 |
Only the third and fourth entries are correct. I am trying to find entries that are like the first two entries and update the number field to contain the type. So, find the first and second rows and update them to the third and fourth rows respectively.
I tried
Select *
from licenses
WHERE number
NOT LIKE type
+'%'
to try and select them before trying an update query, and I get error #1064. I have found several solutions that find if the value in one column is present anywhere in another column, but I need to know if the number
field contains the type
field from the SAME ROW.