Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9305481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T23:56:19+00:00 2026-06-18T23:56:19+00:00

I have two tables : first one stores main informations and the second stores

  • 0

I have two tables : first one stores main informations and the second stores some extra informations. I need to update the first table with the help of some data stored at second table.

My SELECT statement is working

SELECT  news.news_id, 
        news.title, 
        news.cat_id, 
        news.sub_cat_id, 
        news_extra.date_vision_tr
FROM news_extra
    JOIN news 
        ON news.news_id = news_extra.news_id
WHERE news.cat_id=1 AND sub_cat_id=5 AND news_extra.date_vision_tr < CURDATE()

Than I tried UPDATE statement like this

UPDATE news SET news.sub_cat_id=8 
FROM news
   INNER JOIN news_extra
        ON news.news_id = news_extra.news_id
WHERE news.cat_id=1 AND sub_cat_id=5 AND news_extra.date_vision_tr < CURDATE() 

But its not working. Giving this error

*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 ‘FROM news INNER JOIN news_extra ON news.news_id =
news_extra.news_id WHERE news.’ at line 2*

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T23:56:20+00:00Added an answer on June 18, 2026 at 11:56 pm

    The syntax you are using is for SQL Server.

    Here is the syntax for MySQL

    UPDATE  news a
            INNER JOIN news_extra b
                ON a.news_id = b.news_id
    SET     a.sub_cat_id = 8 
    WHERE   a.cat_id = 1 and 
            sub_cat_id = 5 and 
            b.date_vision_tr < CURDATE() 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two table views, when user clicks one cell of the first, second
I have two tables in my application. The first one, Sections, stores content for
i have two data tables with the same structure the first one has one
I have a tree table with two columns on a page. The first one
I have a table inside a form. It has two columns, the first one
I have two tables. The first table has a column with a lot of
I have two tables like the below one in my DB. In the first
I have two servers, the first one with SQL Server 2005 and the second
I have two tables: order and order_status . In the first one I store
I have two tables with hierarchyid fields, one of which is a staging table

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.