S
S
snake22022-03-24 13:00:01
PHP
snake2, 2022-03-24 13:00:01

How to specify 1 as a column in selectRaw?

->selectRaw(select 1
            from users
            where users.id in (3, 5 ,7))

now gives error column 1 not found

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Kuznetsov, 2022-03-24
@dima9595

Are you sure you have a column called 1 in your users table?

How to specify 1 as a column in selectRaw?

Column names must not be numeric! string only!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question