One column CSV -> IN () block
I seem to have to do this quite frequently... It's a lovely hack around MySQL < 4.1 not having subselects. I end up dumping the 1 column of my search to CSV via phpMyAdmin (yeah... everyone does seem to use it, don't they) and then end up doing some hand editing. One day I realized I can just VIM script it.
The goods
:%s/\"//g :%s/$/,/g :%j $v$d :%s/^/IN (/g :%s/$/)/g
Script files
Well, so far this is a macro. Not sure if macros persist, or if you can save them (or if those are just scripts?). I need to read more, but don't currently have time.This page is CategoryHowTo