Solved

numerous varchar columns in one row

Posted on 2012-12-27
3
198 Views
Last Modified: 2013-01-12
table has email1 email2 email3
varchar

I want to select the row (name,phoneNumber) for each email
0
Comment
Question by:rgb192
[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
3 Comments
 
LVL 22

Accepted Solution

by:
mcsween earned 500 total points
ID: 38724303
Let's see if I understand.  You have a table like this:
Name, PhoneNumber, Email1, Email2, Email3

Open in new window

and you want it to return like this?:
Bob,555-1212,bob@mail.com
Bob,555-1212,bob@gmail.com
Bob,555-1212,bob@yahoo.com

Open in new window

That would look like this:

SELECT name,phoneNumber,email1
UNION ALL
SELECT name,phoneNumber,email2
UNION ALL
SELECT name,phoneNumber,email3
FROM sometable
WHERE name = 'Bob'

Open in new window

0
 

Author Comment

by:rgb192
ID: 38730361
SELECT first_name,email1
UNION ALL
SELECT first_name,email2
UNION ALL
SELECT first_name,email3
FROM family

Error Code: 1054. Unknown column 'first_name' in 'field list'
0
 

Author Closing Comment

by:rgb192
ID: 38771005
this answer is close to the question
because I think a union would work


thank you
0

Featured Post

Turn Insights Into Action

You’ve already invested in ITSM tools, chat applications, automation utilities, and more. Fortify these solutions with intelligent communications so you can drive business processes forward.

With xMatters, you'll never miss a beat.

Question has a verified solution.

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

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

690 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