Reputation: 21
I'm trying to awnswer this question: When did the customer with customer_ID ''NN8'', travel to Wien, and for how much ?
These are my tables
''Ticket'' table (with foreignkeys Customer_ID and Ticket_ID)
Attributes are:
[Customer_ID][Ticket_ID]
NN8 ETG987
''Destination'' table (with Primary key ticket_ID)
Attributes are:
[Ticket_ID][city][Price][Country][departure_date][departure_time][arrival_date][arrival_time][departure_city][arrival_city]
(Values in linear order are)
[ETG987][Wien][Austria][20151212][17:00][20151212][20:00][Karlstad][Wien]
This is the command I'm typing in:
Select ticket.customer_ID, destination.departure_time, destination.arrival_city, destination.price
FROM ticket, destination
Where ticket.ticket_ID=destination.ticket_ID and arrival_city=’%Wien%’
Then I'm getting this error message:
Error Code: 1054. Unknown column '’' in 'where clause'
Upvotes: 1
Views: 6688
Reputation: 37119
Try this:
Select
ticket.customer_ID, destination.departure_time,
destination.arrival_city, destination.price
FROM ticket t
INNER JOIN destination d ON ticket.ticket_ID=destination.ticket_ID
WHERE arrival_city LIKE '%Wien%'
In the above query I have changed your quotation style around %Wien%
and implemented JOIN
s
Upvotes: 2
Reputation: 62130
In ’%Wien%’
, you have to use a proper single quote ('
) instead of this weird quote ’
.
Don't use Microsoft Word for writing SQL code.
Upvotes: 2