Hello i have 2 tables 1 with btwvalues and 1 with orders
I am trying to select the final rate (
if extrahours =1 then finalhourscost = extrahoursrate
else finalhourcost = hoursrate)
i have made an example
http://www.sqlfiddle.com/#!2/dd8d9/17
So what i want is create a row finalhourscost depending on both tables. finalhourcost is not an existing row.
What have i done wrong , as you see it returns 1 instead of 40
SELECT extrahours,
extrahourrate,
hourrate,
CASE extrahours WHEN 0 THEN extrahourrate ELSE hourrate END AS finalrate
FROM bill JOIN cost ON bill.costid = cost.id
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments