1
I’m using the Code Igniter 3 and I’m doing a database query with the following code in the file Model
:
$this->db->select("*");
$this->db->where("CASE WHEN code = '001' THEN '1'
WHEN code = '002' THEN '2'
WHEN code = '003' THEN '3'
WHEN code = '004' THEN '4'
WHEN code = '005' THEN '5'
ELSE title END",FALSE);
$this->db->from("lik");
$query = $this->db->get();
It returns only the data I put in CASE WHEN
but does not return the rest of the table. I need you to return all the results and in 1 those 5 that are in the CASE WHEN
.
"It returns only the data I put in CASE WHEN but does not return the rest of the table", this rest of the table you speak are the other columns of the table?
– RXSD
You’re not doing it wrong? Shouldn’t it be on
SELECT
?– novic
Exact André Felipe, I have a table and this table returns only the data from CASE WHEN but does not return the rest of the table data
– matheus