mysql create trigger
MySql.createdbSQL = "CREATE DEFINER=`root`@`localhost` trigger Table1InsertAfter after insert on Table1Update for each row Begin call aobm(new.StudentCode,new.AggregateQuantity,new.Score,new.Side,new.ScoreLevel,new.UpdateAction); end";
try{MySql.RunMySql();}catch (SQLException e){e.printStackTrace();}
create view
MySql.createdbSQL = "drop view if exists aobm";
try{MySql.RunMySql();}catch (SQLException e){e.printStackTrace();}
MySql.createdbSQL = "CREATE VIEW aobm AS (select b.Studentcode bStudentcode, a.Studentcode aStudentcode , b.tick tick ,b.Scorelevel blevel ,b.aggregatequantity bqty,b.Score bScore,a.Score aScore, a.aggregatequantity aqty, a.Scorelevel alevel, a.tick atick from bidside b left join askside a on a.Studentcode=b.Studentcode and a.tick=b.tick) union (select b.Studentcode bStudentcode,a.Studentcode aStudentcode, b.tick tick ,b.Scorelevel blevel ,b.aggregatequantity bqty,b.Score bScore,a.Score aScore, a.aggregatequantity aqty,a.Scorelevel alevel, a.tick atick from bidside b right join askside a on a.Studentcode=b.Studentcode and a.tick=b.tick) order by tick";
try{MySql.RunMySql();}catch (SQLException e){e.printStackTrace();}
沒有留言:
張貼留言