dongrendang6566 2017-03-08 17:22
浏览 48

PHP Laravel SQL或Eloquent或Query构建器

I am new to Laravel 5.4. I am facing a big problem to make decision whether I should focus on mySQL or Elequent or query builder to make complex query.

For example: I need a electric bill report based on different charge range.

0-99=>$120
100-199=>$200
200-299=>$220
300-399=>$250

How can make a elequent query or query builder to make a report with other data such as Customer name, address, phone, sum of total, with details list of which range is being charged to him etc?

Should I use raw SQL query for this?

As I am using AngularJs, I have to return all this in a single query. If you want to help me using a controller, you can show me.

What can I do?

I used .Net where I can make this easily by LINQ query, but I am stuck here!

I think laravel query builder is not powerful like LINQ. Leave .Net if you are not familiar with it.

Anyways, I need help to get out of the problem. How can I write that complex query?

Desired result:

Suppose I have Customers table, Billranges table and Bill table

I need:

Customername-Address-Metter-Charge-Bill
John-Dhaka-250-$220 -55000(250x220)

Can I do this in Laravel 5.4 Query builder?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥15 c++头文件不能识别CDialog
    • ¥15 Excel发现不可读取的内容
    • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题