IF, THEN ELSE statement

2003-09-10 Thread Rob Anderson
I am trying to update/insert a record into the table depending on whether it exists in the table or not. Something along the lines of... IF (SELECT id FROM myable WHERE id="myid") INSERT INTO mytable(id,name) VALUES ("myid", "myname") ELSE UPDATE mytable SET name="mynewname" WHERE

DELETING items

2001-07-16 Thread rob anderson
I am trying to delete records from a table, where the 'id' to be deleted should only happen if a certain flag (status) exists. The table contains one or more records for the same id, only the flag changes. I have tried create temporary table temp (id int not null); select id from tracking w

Comments in a table

2001-02-02 Thread rob anderson
Hi, Is it possible to put comments against a table and column that are persistent; so that when you run 'explain' or 'describe', these comments will display. Rob

Joins to one table form two columns

2001-01-23 Thread rob anderson
I am new to MySQL so don't laugh! I have a table 2 fields that relate to another table (that stores the description) i.e history id status1 status2 statusText id details How can I join the history.status1 and history.status2 fields to the statusText table? in order that I can display id