Microsoft
Software
Hardware
Network
Question : Update from SQL Query
Hi There
I have a database table TblSubsegmentationTypeDeta
ils. That looks like as follows.
ID Subsegmentationtypeid PriceDescription
4 19 R 205 300– R 258 900
3 20 R 189 400 – R 205 600
5 21 R 251 700 – R 278 200
6 22 R 177 200 – R 198 200
7 23 R 213 700 – R 243 500
8 24 R 247 800 – R 270 600
9 25 R 132 800 - R 136 000
10 26 R 149 100 – R 157 500
I am trying to update the price description filed from another SQl select statement.
Select
A.[VehicleRangeID], VehicleModelId , B.min_Price, B.Max_Price
From [ToyotaVehicleDB_Staging].
[dbo].[Veh
icleModels
] A
join (Select [VehicleRangeID], Min(Price) min_Price, Max(Price) Max_Price from [ToyotaVehicleDB_Staging].
[dbo].Vehi
cleModels group by [VehicleRangeID]) B
on A.[VehicleRangeID] = B.[VehicleRangeID]
The problem I am having is the link from the sql statement to the table sits in another table.tblSubsegmentation
ID subsegmentationtypeid vehiclemodelid
1 3 14
2 4 15
3 5 20
4 6 1
5 7 5
6 8 7
7 9 48
8 10 50
So basically want i want to do is
UPDATE TblSubsegmentationTypeDeta
ils
set PriceDescription = Select Query min '-' select qery max
where Subsegmentationtypeid = Subsegmentatointypeid (for the vehiclemodelid from the select query where the vehiclemodelid is in the tblsubsegmentation)
I hope I have explained myself correctly.
Let me know if you need any more information.
Thanks
Stanton
Answer : Update from SQL Query
Stanton_Roux,
did you try my update query in comment 26512278?
-Ajitha
Random Solutions
Royal Flush Browser Test
How to create links in access tables
Installing Exchange 2007 Managment Tools on Windows 7
Displaying list data in a Microsoft Report Viewer control
File Conversion window opens when I try open a Word .doc
Unable to remove buritos.exe trojan from UPS email
SBS 2003 Error - Windows could not start because of an error in the software. Please report this problem as : load needed DLLs for kernel.
Read matching files in a folder, read one of them and insert the Data in a Table
WHAT IS AN ILIST,IDATASOURCE,IENUMERA<wbr />BLE
VBA - Combo Box ID