database - mysql calculation several column -
i have current db following queries:
table name : service fields: service_id,name,labor_hour,part_cost,rate_id
`service_id` `primary key` rate_id foreign key references rate(rate_id) rate(rate_id,labor_cost_per_hour) primary key(rate_id)
table name: order_service fields :
order_service_id,order_id,service_id order_service_id primary key order_id foreign key references order(order_id) service_id foreign key references service(service_id) service cost = labor hours * labor cost per hour + part cost i want list service id , cost of services costs more number. not sure how calculation service cost in mysql; thought inner join 2 tables, seems not work. give me helps? thanks!
try this
select service_id,(labor hours * labor cost per hour + part cost) service s inner jion rate r on r.rate=s.rate (labor hours * labor cost per hour + part cost) > 500
Comments
Post a Comment