Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing sql with COUNT #16

Open
saif7amed opened this issue Sep 29, 2024 · 0 comments
Open

Parsing sql with COUNT #16

saif7amed opened this issue Sep 29, 2024 · 0 comments

Comments

@saif7amed
Copy link

Hi and thanks for the awesome tool

I face issue parsing this query:

select *, count(id) as count from products

I got:

DB::table("products")
->select("*", "count (id) as count")
->get();

It has did not work for 2 issues:

First:
I had to add DB::raw for the count part

Second:
I got the issue Function Name Parsing and Resolution and solve it by removing the whitespaces between the name and the following ( parenthesis character

Final code:

DB::table("products")
->select("*", DB::raw("count(id) as count"))
->get();
@saif7amed saif7amed changed the title Parsing sql with count issue Parsing sql with COUNT Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant