Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

200
Views
Why am I getting this syntax logic error?

I have a basic Windows Forms application that connects and displays databases. I want to update one of the databases using information from two tables,

    UPDATE account AS a
    SET accrued = (a.accrued + ((p.intrate/365)*balance))
    FROM customer c JOIN product p
    ON p.prodid = a.prodid
    WHERE c.custid = a.custid AND active = 1

That works in DB browser

using (SQLiteCommand cmd = connAccount.CreateCommand())
{
    // adds customers details to the database
    cmd.CommandText = @"UPDATE account AS a SET accrued = (a.accrued + ((p.intrate / 365) * balance)) FROM customer c JOIN product p ON p.prodid = a.prodid WHERE c.custid = a.custid AND active = 1";

    cmd.ExecuteNonQuery();
    MessageBox.Show("Daily Accrued Updated");
}

That in my application gives me the error:

System.Data.SQLite.SQLiteException: 'SQL logic error near "FROM": syntax error'

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The syntax of the UPDATE...FROM statement in your code is not supported for versions of SQLite older than 3.33.0.

You can use older syntax with a correlated subquery:

UPDATE account AS a
SET accrued = a.accrued +
    (SELECT p.intrate/365
    FROM customer c JOIN product p
    ON p.prodid = a.prodid
    WHERE c.custid = a.custid) * a.balance
WHERE a.active = 1
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!