반응형
y SQL 절 MONTH로 테스트가 작동하지 않는 날짜 필드 "fechas"(datetime 유형)에서 월 검색을 시도했습니다 ... 회신 주셔서 감사합니다
$data = DB::table("ordenes")
->select(array('*', DB::raw('((cant_ped)*(precio_unit)) as sum_pedidos'), DB::raw('((cant_pend)*(precio_unit)) as sum_pends'), DB::raw('((cant_rec)*(precio_unit)) as sum_recibidos'), DB::raw('(((cant_pend)*(precio_unit)) + ((cant_rec)*(precio_unit))) as sum_importe')))
->where('cod_prov', '<>', 0)
///////////// line ERROR
->where('MONTH(fecha)', '=', '06')
///////->where('MONTH(fecha)', '=', '2014-06-20') ///test OK
->groupBy('cod_prov')
->skip(Input::get("jtStartIndex"))
->take(Input::get("jtPageSize"))
->get();
해결 방법
hide gem whereMonth
를 사용할 수 있습니다.
DB::table("ordenes")
->whereMonth('fecha', '=', '06')
->get();
다른 gem을 검색하려면 Builder.php 소스를 읽어 보시기 바랍니다. :)
참조 페이지 https://stackoverflow.com/questions/25173471
반응형
'MySql' 카테고리의 다른 글
MySQL PostgreSQL에 비해 Mysql에 진공이 필요하지 않은 이유는 무엇입니까? (0) | 2020.12.02 |
---|---|
MySQL 개수 / 중복 선택 (0) | 2020.12.02 |
MySQL ImportError : 큐라는 모듈이 없습니다. (0) | 2020.12.02 |
MySQL JPA- 엔티티가 아닌 클래스의 두 테이블 결합 (0) | 2020.12.02 |
MySQL 이 PDO 준비 문은 false를 반환하지만 오류를 발생시키지 않습니다. (0) | 2020.12.02 |
댓글