Solved

Syntax for MySQL text that contains a   an apostrophe

Posted on 2016-07-27
2
37 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
Comment Utility
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 21

Accepted Solution

by:
Kim Walker earned 500 total points
Comment Utility
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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Join & Write a Comment

More Fun with XML and MySQL – Parsing Delimited String with a Single SQL Statement Are you ready for another of my SQL tidbits?  Hopefully so, as in this adventure, I will be covering a topic that comes up a lot which is parsing a comma (or other…
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now