Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
-
Contact:
Post
by simonmlewis »
I want to copy the contents of one field in all rows, to another field. ie. Category to be copied into Catname.
I have tried this:
Code: Select all
UPDATE [yourTable] SET `cost` = `salesprice`;
But all it does is to MOVE it. Category ended up empty!!
What's the method??
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
-
Contact:
Post
by simonmlewis »
UPDATED: APOLOGIES: your code is the other way around. I did it the wrong way didn't I. WILL TRY NOW.
Sorry but as my original post states, that code MOVES the data to the other field, it does not COPY it.
I need to copy it - so the same contents are in TWO fields.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
-
Contact:
Post
by simonmlewis »
Bingo thanks.
Logical really. Durr!!
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.