BMS-HOSxP Community

HOSxP => การเขียน SQL Script => ข้อความที่เริ่มโดย: doramon ที่ กันยายน 04, 2010, 14:55:33 PM

หัวข้อ: ฝาก ตัวอย่าง SQL แบบ View Table
เริ่มหัวข้อโดย: doramon ที่ กันยายน 04, 2010, 14:55:33 PM
CREATE ALGORITHM=UNDEFINED DEFINER=`sa`@`%` SQL SECURITY DEFINER VIEW `opitem_group_vn_sum` AS (select `opitemrece`.`hn` AS `hn`,`opitemrece`.`vn` AS `vn`,`opitemrece`.`rxdate` AS `rxdate`,`opitemrece`.`rxtime` AS `rxtime`,`kskdepartment`.`department` AS `department`,sum(`opitemrece`.`sum_price`) AS `sumall`,`doctor`.`name` AS `doctorname` from ((`opitemrece` join `doctor` on((`opitemrece`.`doctor` = `doctor`.`code`))) join `kskdepartment` on((`opitemrece`.`dep_code` = `kskdepartment`.`depcode`))) group by `opitemrece`.`vn`)