Solved

MYSQL Select Statement no longer works

Posted on 2013-05-16
3
469 Views
Last Modified: 2013-05-16
Hi
I have recently move a web application onto MySQL 5 and the following select statement no longer works.
When I run the query in PHPMyAdmin, it returns 3 rows in the following format.

tact.*      tcp.*      te.* [table header]
tact.*      tcp.*      te.*
tact.*      tcp.*      te.*
tact.*      tcp.*      te.*

SELECT 'tact.*', 'tcp.*', 'te.*' FROM tblaction AS tact, tblcomproblem AS tcp, tblcalllog AS tclog, tblengineers AS te WHERE tcp.prId = tclog.clProblemReported AND tclog.clId=tact.clId AND tact.clId = 41305160002 AND tact.eId = te.eId ORDER BY aDate ASC LIMIT 0, 15

Open in new window


I would be grateful for somehelp as I'm not an expert on SQL statements
0
Comment
Question by:gracetec
[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
3 Comments
 
LVL 20

Accepted Solution

by:
dsacker earned 400 total points
ID: 39171191
Take off the single quotes. Or if all you want is all columns from all tables, simply SELECT * FROM ....
0
 

Author Closing Comment

by:gracetec
ID: 39171414
Thanks for your help, I couldn't figure it out :)
0
 
LVL 22

Expert Comment

by:Kim Walker
ID: 39171473
dsacker is correct. The single quotes are wrong. They should be removed or you should use tick marks (under the tilde beside the 1 key on your keyboard) around your table and field names. For example
SELECT 
	`tact`.*, 
	`tcp`.*, 
	`te`.* 
FROM 
	`tblaction` AS `tact`, 
	`tblcomproblem` AS `tcp`, 
	`tblcalllog` AS `tclog`, 
	`tblengineers` AS `te` 
WHERE 
	`tcp`.`prId` = `tclog`.`clProblemReported` 
	AND `tclog`.`clId` = `tact`.`clId` 
	AND `tact`.`clId` = 41305160002 
	AND `tact`.`eId` = `te`.`eId` 
ORDER BY 
	`aDate` ASC 
LIMIT 
	0, 15

Open in new window

Tick marks are primarily used to avoid table name and field name conflicts with reserved words. In your case they are unnecessary but I use them religiously to avoid any possibility of conflict.
0

Featured Post

Webinar: Security & Encryption in the MySQL world

Join Percona’s Solutions Engineer, Dimitri Vanoverbeke as he presents “Security and Encryption in the MySQL world” on Thursday, July 6, 2017 at 7:00 am PDT / 10:00 am EDT (UTC-7).

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
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, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

724 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