1

I'm using CodeIgniter and I'm having difficulty trying to figure this out.

So I have this query that includes a joined table, then I need the ua_number column from that joined table for concatenation for the image column. The ua_number returns a value no problem but when I append it to the concatenation, it doesn't work as planned.

Here's the code

$this->db
    ->select(" 
        p.promotion_id,
        p.partner_id,
        ps.ua_number AS ua_number,
        description,
        start_date,
        end_date,
        date_created,
        CONCAT('https://s3-ap-southeast-1.amazonaws.com/paychatph-assets/pcb_updates/promotions/', MD5(p.promotion_id), '/', (ps.ua_number), '.jpeg')  AS image
    ")
    ->from('promotions p')
    ->join('partners ps' , 'p.partner_id = ps.partner_id' , 'INNER');
1
  • If the dupe target doesn't resolve your issue, then we will need more Debugging Details. How doesn't it "work as planned"? is it returning NULL? Missing a portion? The entire query fails with an error? What is the rendered query? Commented Nov 10 at 20:18

2 Answers 2

0

is the problem that in the concat statement you have a ' at the beginning and a " at the end? I would think they need to match inside a single statement.

Sign up to request clarification or add additional context in comments.

Comments

0

Have you tried to add a pa.ua_number, to your select fields list? Maybe renaming it as ua_number broke something.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.