Solved

Syntax for MySQL text that contains a   an apostrophe

Posted on 2016-07-27
2
61 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

This guide whil teach how to setup live replication (database mirroring) on 2 servers for backup or other purposes. In our example situation we have this network schema (see atachment). We need to replicate EVERY executed SQL query on server 1 to…
Foreword This article was written many years ago, in the days when PHP supported the MySQL extension (http://php.net/manual/en/function.mysql-connect.php).  Today (http://php.net/manual/en/migration70.removed-exts-sapis.php) you would not use MySQL…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

726 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