Solved

Codeignitor Query

Posted on 2016-08-26
1
30 Views
Last Modified: 2016-09-09
I have a query that works but I need to add to it and I am not sure how.  I need to pull two different fields.

Right now it looks like this
<?php
  SELECT
                CASE
                    WHEN o.business_type_id = 1 THEN o.first_name
                    WHEN o.business_type_id = 4 THEN o.legal_name 
                    ELSE o.business_name
                END 

Open in new window


But I need to pull the First_Name and the Last_Name

Like this:
<?php
  SELECT
                ### Line 1 ###
                CASE
                    WHEN o.business_type_id = 1[b] THEN o.first_name AND .o.last_name[/b]
                    WHEN o.business_type_id = 4 THEN o.legal_name 
                    ELSE o.business_name
                END 

Open in new window

0
Comment
Question by:rgranlund
1 Comment
 
LVL 40

Accepted Solution

by:
Sharath earned 500 total points
ID: 41772552
try if it supports CONCAT.
<?php
  SELECT
                CASE
                    WHEN o.business_type_id = 1 THEN CONCAT(o.first_name, o.last_name)
                    WHEN o.business_type_id = 4 THEN o.legal_name 
                    ELSE o.business_name
                END 

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
CA single sign on 2 73
Regex PHP lines with newlines not being matched - all other match fine 4 22
html input type 3 21
Method for submitting dynamically created rows 20 16
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

911 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now