5 months ago

select data which created_at today Error

Posted 5 months ago by EMfinanga

i want to get the create_at today, but i get the the below error

my code

                  ->select('addressitems.clientName','sales.address_id',DB::raw('SUM(sales.amount) as 
                  ->whereRaw('date(created_at) = ?', [Carbon::today()])
          return view('sales.salesView', compact('salesView','salesview'));

my error

           SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'created_at' in field list is ambiguous 
             (SQL: select `addressitems`.`clientName`, `sales`.`address_id`, SUM(sales.amount) as 
      totalAmount, `addressitems`.`clientPhone`, `created_at` from `addressitems` inner join `sales` on 
    `sales`.`address_id` = `addressitems`.`id` group by `address_id`)

the data is not coming, some can assist me

Please sign in or create an account to participate in this conversation.