Search code examples
phpmysqlfluent

How can I concat column using FluentPDO?


Lets say I've table user with columns firstname, lastname and col3

SELECT col3, CONCAT(firstname, ' ', lastname) as firstlast 
FROM users

This query will work fine in MySql but how can I replicate this in FluentPDO?

I can't find it on official documentation Fluent Documentation and If it is not present in FluentPDO then what can be work around for this?

Any suggestion/hint would be helpful. Thanks :)


Solution

  • Not familiar with FluentPDO but from the documentation link you send, this should work:

    $query = $fpdo->from("users")->select("CONCAT(users.firstname, ' ', users.lastname) as firstlast");