DELIMITER $$
### PROCEDURE ------ ###
DROP procedure IF EXISTS bitnami_redmine.proc1 $$
CREATE PROCEDURE bitnami_redmine.proc1(IN Process TEXT, IN Maker TEXT, IN ProbType TEXT)
BEGIN
# DECLARE i INT DEFAULT 0;
# DECLARE min_beforedate INT DEFAULT 0;
select a2.customized_id, a2.value, c.value from
(select a.customized_id, a.value, a.custom_field_id from
#(select customized_id, value, custom_field_id from custom_values as a where (custom_field_id = 17 and value = 'BOSCH')) as a
(select customized_id, value, custom_field_id from custom_values as a where (custom_field_id = 17 and value = Maker)) as a
inner join
#(select customized_id, value, custom_field_id from custom_values as b where (custom_field_id = 1 and value = 'PAINT')) as b
(select customized_id, value, custom_field_id from custom_values as b where (custom_field_id = 1 and value = Process)) as b
where a.customized_id = b.customized_id) as a2
inner join
#(select customized_id, value from custom_values as c where (custom_field_id = 3 and value = 'SFEM S/W')) as c
(select customized_id, value from custom_values as c where (custom_field_id = 3 and value = ProbType)) as c
where a2.customized_id = c.customized_id;
END $$
DELIMITER ;
'Programming > Database' 카테고리의 다른 글
SQL문 예제 - MySQL (0) | 2012.11.29 |
---|---|
Table Join 소요시간 (MySQL) (0) | 2012.09.07 |
MySQL error code (1) | 2012.08.28 |