![]() |
[SQL] Need quick help
Hi,
I'm working on the last question of a hw assignment in SQL, and for those that are familiar it utilizes the 'pubs' database in SQL Server. The question is: "Change the ytd_sales (quantity) attribute in the titles table so that it contains the quantity for the books contained in the sales table. The two titles which have no sales should have a zero in their ytd_sales attribute. Assume here that the sales table contains year-to-date sales, even though the table's attributes refers to orders." The issues here is that the 'quantity' value in the sales table, has multiple values per book, a la Code:
title_id qty My plan was to do that, then put the result in a temporary table, then use those values from teh temp table to update the titles table. The problem, is that when I run the code: Code:
SELECT sum(qty),title_id Code:
INSERT INTO tblTemp3(qty,title_id) Code:
UPDATE Titles Please help me troubleshoot this! Thanks! EDIT: Figured it out, thanks all! |
All times are GMT -8. The time now is 03:04 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project