1

The error showing

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near

i think an error in the syntax

update invoice AS t1, 

(select sum(total_cost) from invoice where billno='X-0125' and item='11') AS t2 

set t1.total_cost=(t1.total_cost/(t2.sum(total_cost))*100
                
WHERE t1.billno='X-0125' and t1.item='11'
1
  • set t1.total_cost=(t1.total_cost/(t2.sum(total_cost))*100 I Think you miss ) Commented Jun 7, 2018 at 8:05

1 Answer 1

1

Missing one paranthesis after '100' for example (depends on what you want) but missing one:

update
  invoice AS t1,
  (
    select
      sum(total_cost)
    from
      invoice
    where
      billno = 'X-0125'
      and item = '11'
  ) AS t2
set
  t1.total_cost =(t1.total_cost /(t2.sum(total_cost)) * 100)
WHERE
  t1.billno = 'X-0125'
  and t1.item = '11'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.