mysql增删改查语句多条件查询

mysql增删改查语句

日期范围查询:SELECT * from reel_barcode_luoduo where Date(exec_date) between '{start_time:yyyy-MM-dd}' and '{end_time:yyyy-MM-dd}' order by exec_date asc; //按日期排序

SELECT * FROM zjm.output where mc='3FT02H12' and Date(datetime) between '2021-11-1' and '2021-11-3' order by datetime asc; //多条件按时间升序排序ascend,descend (des) 降序

SELECT mc, shift_class, mn, num_name, output, remark, `datetime`, lasttime, package, rework FROM zjm.`output`where `datetime` like'2021-11-04%' ;

insert into txw_oqa_db.reel_barcode_luoduo set dte=111,sn_reel=111,exec_date="2021-10-21";
delete from  txw_oqa_db.reel_barcode_luoduo where id=4;
update txw_oqa_db.reel_barcode_luoduo set exec_date="2021-10-21" where id=3; 
SELECT * FROM txw_oqa_db.reel_barcode_luoduo;

 

string device = textBox_load_unload_device.Text.Trim();

string wafer_batch_number = textBox_load_unload_wafer_batch.Text.Trim();
string wafer_source = textBox_load_unload_wafer_source.Text.Trim();
//多条件查询,aa___, '_' 这个杠代表占位符1个。匹配一个字符,aa___,有3个杠,就匹配三个字符
string sql_op = $"SELECT * from load_unload_data where end_time between '{start_time}' and '{end_time}' and device like '%xxx' and wafer_batch_number" +
$" like 'aa____' and wafer_source like '{wafer_source}' order by end_time asc;";


string sql_op = $"SELECT * from load_unload_data where end_time between '{start_time}' and '{end_time}' and device like '{device}' and wafer_batch_number" +
$" like '{wafer_batch_number}' and wafer_source like '{wafer_source}' order by end_time asc;";

posted @ 2021-10-21 11:36  txwtech  阅读(152)  评论(0编辑  收藏  举报