I have a table like so:
CREATE TABLE `my_table` (
`id` INT(10) AUTO_INCREMENT,
`code` VARCHAR(50),
`new_table_id` INT(10)
PRIMARY KEY (`id`)
)
And I have a CSV list of code values like so:
'23000005619',
'23000019479',
'23000019759',
'23000030169',
'23000032629'
I want to join this list with my_table.code column such that I can find the value to my_table.new_table_id so I can join that to another table.
My initial thoughts are something along the lines of this (but obviously not syntactically correct):
SELECT *
FROM my_table mt,
(
SELECT
'23000005619',
'23000019479',
'23000019759',
'23000030169',
'23000032629'
) as ml
WHERE mt.`code` = m1.xx
Any help would be greatly appreciated. Thanks
UPDATE
I would like to avoid temp tables where possible
I think I made life harder for myself – this is all that I needed:
I might have thrown people off by saying i wanted a join when in fact no join was required.