본문 바로가기
MySql

MySQL Sequelize-대소 문자를 구분하지 않음

by 베이스 공부 2020. 10. 29.
반응형

Sequelize에서 어떻게이 작업을 수행 할 수 있습니까?

SELECT * FROM table where lower(column) LIKE ('abcd%');

낮은 함수와 $ like 를 혼합하는 방법을 찾을 수 없습니다.

 

해결 방법

 

해결책을 찾았습니다.

Table.findAll({
  attributes: ['createdAt', 'col'],
  where: {
    $and:[
      {
        createdAt:{
          $between:[minDate, maxDate]
        }
      },
      Sequelize.where(
        Sequelize.fn('lower', Sequelize.col('col')),
        {
          $like: 'abcd%'
        }
      )
    ]
  }
});

 

참조 페이지 https://stackoverflow.com/questions/41728023

 

 

반응형

댓글