Solved

Syntax for MySQL text that contains a   an apostrophe

Posted on 2016-07-27
2
66 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 500 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

All XML, All the Time; More Fun MySQL Tidbits – Dynamically Generate XML via Stored Procedure in MySQL Extensible Markup Language (XML) and database systems, a marriage we are seeing more and more of.  So the topics of parsing and manipulating XM…
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

729 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