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

  • SEARCH
  • Home
  • 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 9102909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:29:51+00:00 2026-06-17T01:29:51+00:00

I’m trying to update all rows (only 3 columns I have to update) from

  • 0

I’m trying to update all rows (only 3 columns I have to update) from a table that have an equal value on another table…

Here are my tables…

CREATE TABLE [dbo].[prods](
    [IdProducto] [int] IDENTITY(1,1) NOT NULL,
    [IdGrupo] [int] NULL,
    [IdCategoria] [int] NULL,
    [IdAlmacen] [varchar](50) NULL,
    [Codigo] [varchar](50) NULL,
    [Nombre] [varchar](50) NULL,
    [Descripcion] [varchar](max) NULL,
    [Cantidad] [int] NULL,
    [Imagen] [varchar](max) NULL,
    [StockMin] [int] NULL,
    [StockMax] [int] NULL,
    [Ancho] [varchar](50) NULL,
    [Alto] [varchar](50) NULL,
    [Largo] [varchar](50) NULL,
    [Peso] [varchar](50) NULL,
    [Volumen] [varchar](50) NULL,
    [Color] [varchar](50) NULL,
    [Material] [varchar](50) NULL,
    [Presentacion] [varchar](50) NULL,
    [bitPrecioVentaUnico] [int] NULL,
    [PrecioCompra] [money] NULL,
    [DescuentoCompra] [float] NULL,
    [PrecioVenta] [money] NULL,
    [DescuentoVenta] [float] NULL,
    [Estado] [varchar](20) NULL
)

CREATE TABLE [dbo].[prodnuevos](
    [Codigo] [int] NULL,
    [itemid] [int] NULL,
    [Item] [varchar](255) NULL,
    [Categoria] [varchar](255) NULL,
    [Cantidad] [int] NULL,
    [Minima] [nvarchar](255) NULL,
    [Costo] [money] NULL,
    [Valor] [money] NULL,
    [peso] [float] NULL,
    [unidades] [float] NULL
)

What I want to do is the following..

Update prods 
Set prods.PrecioCompra = prodnuevos.Costo, 
prods.PrecioVenta = prodnuevos.Costo, 
prods.Cantidad = prodnuevos.Cantidad 
WHERE prods.Nombre = prodnuevos.Item;

(Update PrecioCompra, PrecioVenta and Cantidad in prods using prodnuevos’ Costo and Cantidad where Nombre and Item is the same)

Obviosly the query above does not work, but I just wanted to explain my problem.
I have tried various combinations of queries with success at all. (Despite having to update 3 columns, I don’t mind if I have to use 3 different queries)

I have tried things like

    UPDATE       prods c
    SET          c.PrecioCompra =
      (SELECT        a.Costo
      FROM            prodnuevos AS a INNER JOIN
         prods AS z ON z.Nombre = a.Item 
WHERE        (a.Item = c.Nombre))

but no result…

Am I doing something wrong?? or it’s a totally different query??
Thanks in advance.

  • 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-17T01:29:53+00:00Added an answer on June 17, 2026 at 1:29 am
    Update prods Set 
    prods.PrecioCompra = prodnuevos.Costo,
    prods.PrecioVenta = prodnuevos.Costo, 
    prods.Cantidad = prodnuevos.Cantidad
    from prods inner join prodnuevos
    on prods.Nombre = prodnuevos.Item
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a text area in my form which accepts all possible characters from
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I have a small JavaScript validation script that validates inputs based on Regex. I
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to create an if statement in PHP that prevents a single post
I have a view passing on information from a database: def serve_article(request, id): served_article

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.