Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Syntax for MySQL text that contains a   an apostrophe

Posted on 2016-07-27
2
Medium Priority
?
75 Views
Last Modified: 2016-07-30
How can I change the syntax to get this to run:

SELECT shrcode, shrfirm, shrdiv * shrqty AS [Max's Total Dividend]
     FROM shr;

It says there is an error at [ ... this runs in MS Access.

I've tried
SELECT shrcode, shrfirm, shrdiv * shrqty AS "Max's Total Dividend"
     FROM shr;

but this doesn't work either in MySQL
0
Comment
Question by:chonabraham
2 Comments
 
LVL 6

Expert Comment

by:Manuel Marienne-Duchêne
ID: 41731762
Try
SELECT shrcode, shrfirm, shrdiv ,shrqty AS 'Max''s Total Dividend'     FROM shr
OR
SELECT shrcode, shrfirm, shrdiv ,shrqty AS 'Max\'s Total Dividend'
     FROM shr
0
 
LVL 22

Accepted Solution

by:
Kim Walker earned 2000 total points
ID: 41731847
Table names, column names, and aliases are considered identifiers. The identifier quote character is the backtick (“`”). So try:
SELECT shrcode, shrfirm, shrdiv * shrqty AS `Max's Total Dividend`
     FROM shr;

Open in new window

0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question