ADOQuery3.SQL.Add('SELECT program_item_visit.*,operation.operator as operator,operation.type');
ADOQuery3.SQL.Add('FROM program_item_visit INNER JOIN operation ON');
ADOQuery3.SQL.Add('(operation.material_no=program_item_visit.material_no AND program_item_visit.`program_id`=operation.`program_id` AND program_item_visit.`lineseat`=operation.`lineseat`)');
ADOQuery3.SQL.Add('WHERE line='''+cbbline.Text+''' AND work_order='''+cbbwork_order.Text+''' AND board_type='''+cbbtype.Text+''' ORDER BY last_operation_time DESC LIMIT 1');
ADOQuery3.Parameters.parambyname('operator').Value:=DBEdit1.Text;
ADOQuery3.Open;
//DBEdit2.Text:=ADOQuery3.fieldbyname('operator').AsString;
//fieldbyname('operator').AsString;
//DBEdit2.Text:=ADOQuery3.fieldbyname('scan_lineseat').AsString;
//DBEdit3.Text:=ADOQuery3.fieldbyname('lineseat').AsString;
//DBEdit4.Text:=ADOQuery3.fieldbyname('material_no').AsString;
//DBEdit5.Text:=ADOQuery3.fieldbyname('scan_material_no').AsString;