Solved

Codeignitor Query

Posted on 2016-08-26
1
31 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Checking CSRF token within a function 36 74
javascript: add id amounts 5 46
how to use 2 SELECT statements with prepared statements 19 28
PHP curl issue VERBOSE output 18 36
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
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 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 …

785 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