MySQL Forums
Forum List  »  Newbie

Replacing things in relational database - JOIN, maybe?
Posted by: Paul Roper
Date: April 21, 2015 06:43AM

Hello,
I have a couple of tables with some shared values, and I need (I think) to do some kind of JOINing to replace some data. I'm sure it's relatively straightforward, but I just can't get my head around it. Here's the problem:

I have two tables:
tickets
events

tickets has (amongst other columns) event_id and ticket_price.

events has (amongst other columns) event_id and event_name.

event_id is (as far as I can tell) the constraint between the two tables.

I need to change the price of the tickets (tickets.ticket_price) for all events with a specific events.event_name to one value (50).

events.event_name will be, for example, 'New York'. There are many events in New York, each with a unique event_id.

So I need to do something along the lines of:

SET tickets.ticket_price TO '50' WHERE tickets.event_id = events.event_id WHERE events.event_name = 'New York'

I certainly do not want to alter the structure/relationships of the database in any way - it's used by a Wordpress plug-in which I did not create. From some research, it sounds as if this is a case for an inner JOIN. Does the JOIN command change the database or is it just used for search results?

Any suggestions would be greatly appreciated!

- Paul

Options: ReplyQuote


Subject
Written By
Posted
Replacing things in relational database - JOIN, maybe?
April 21, 2015 06:43AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.