Solved

Codeignitor Query

Posted on 2016-08-26
1
25 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
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article discusses how to create an extensible mechanism for linked drop downs.
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

744 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

11 Experts available now in Live!

Get 1:1 Help Now