Solved

Help with MySql SELECT statement: SELECT lname, fname

Posted on 2009-07-09
3
738 Views
Last Modified: 2013-12-13
Help with MySql SELECT statement: SELECT lname, fname

SELECT lname "," fname as 'STUDEN NAME'
FROM intenrollment
WHERE confirm = 'Y' and policyno='2008

I want the name to look like this: Anderson, Tom
0
Comment
Question by:Willy3g
[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 8

Accepted Solution

by:
stefanx earned 500 total points
ID: 24819264
SELECT CONCAT(lname,', ',fname) FROM intenrollment
0
 
LVL 6

Expert Comment

by:BALMUKUND KESHAV
ID: 24820972
You are missing , in your query, try this :

SELECT trim(lname), ",",trim(fname) as 'STUDEN NAME'
FROM intenrollment
WHERE confirm = 'Y' and policyno='2008'

Bm keshav

0
 
LVL 18

Expert Comment

by:Sudaraka Wijesinghe
ID: 24822462
I would do it using concat also. but watch out if either lname or fname is null, the whole thing will come out as null
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

This article discusses how to implement server side field validation and display customized error messages to the client.
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

630 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