字符串查询在日期之间搜索和过滤

时间:2015-05-21 12:54:59

标签: sql date search filter between

String query = "SELECT * 
                FROM salesTable 
                where timeStamp BETWEEN '"+startdate+"' 
                AND '"+enddate+"' ( sellid LIKE '%"+search_str+"%'  
                OR tastemodel LIKE '%"+search_str+"%'  
                OR bezeichnung LIKE '%"+search_str+"%' 
                OR sellid LIKE '%"+lastName+" "+firstName +"%'      ) 
                ORDER BY timeStamp DESC";

如何将常规字符串搜索与两个日期之间进行组合?

1 个答案:

答案 0 :(得分:0)

使用AND正确组合术语。

...'" + enddate + "' AND (sellid LI...
//                   ^^^