这是我的表格结构。我希望在提供的日期范围之间获得记录。
static void a1()
{
int choice;
Scanner sc1 = new Scanner(System.in);
System.out.println();
System.out.print("Enter Part#: ");
pa[count] = sc1.nextLine();
System.out.println();
System.out.print("Enter Make: ");
ma[count] = sc1.nextLine();
System.out.println();
System.out.print("Enter description: ");
so[count] = sc1.nextLine();
System.out.println();
System.out.print("Enter price: ");
pr[count] = sc1.nextLine();
++count;
}
我尝试了以下查询,但没有成功。
|--------------|---------------------|
| id | year | month |
|--------------|---------------------|
| 1 | 2015 | 01 |
| 2 | 2015 | 02 |
| 3 | 2016 | 02 |
|--------------|---------------------|
答案 0 :(得分:0)
试试这个:
$this->db->select('*')
->from('test T')
->where('T.year >='.$where['s_year'].' and T.month >='.$where['s_month'])
->where('T.year <='.$where['s_year'].' and T.month <='.$where['s_month'])
->get()->result();