Hi, Say I have a table with 2 columns. The first is the primary key (int(11), unique, auto-increment). The second column is a varchar(20) (also unique and indexed). This is part of a search engine.
Whenever a new document is indexed then for each word I have to do 2 queries: look up in the table if the word exists, if yes -> use key, if no -> insert and use key. I want to be able to combine these actions into one INSERT query which returns the primary key whenever a word already exists, or insert the word and then returns the (newly created) primary key. Anyone any idea if this is possible? If yes, how this is possible? Cheers, Harald