Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jonasalbert20
Constraint Violating Yak Guru
300 Posts |
Posted - 2004-10-28 : 23:30:47
|
This are my datas...tblStocksStockCode -Item-----------------------------S2004J8001 -BurgerS2004JM000 -SiopaotblStockQueueqQueueCode -qPriority -qStockCode -qPrice--------------------------------------------------------Q2004JK000 -1 -S2004J8001 -2.00Q2004JM000 -1 -S2004JM000 -9.00Q2004JR000 -2 -S2004J8001 -3.00tblStockLocalsiStockCode -siQueueCode -siPrice -siItem-------------------------------------------------------S2004J8001 -Q2004JK111 -1.00 -KikiamNow i want to update tblStockLocal and set siQueueCode, siPrice, siItembased on the MINiMUM value of qPriority by qStockCode = 'S2004J8001' specified.Result...siStockCode -siQueueCode -siPrice -siItem-------------------------------------------------------S2004J8001 -Q2004JK000 -2.00 -Burgerupdate using left join i think? Want Philippines to become 1st World COuntry? Go for World War 3... |
|
|
hgorijal
Constraint Violating Yak Guru
277 Posts |
Posted - 2004-10-29 : 03:08:16
|
| inner join inline-view with top 1 order byHemanth GorijalaBI Architect / DBA...(yuhoo!!! and now, an "Yak Master")Exchange a Dollar, we still have ONE each.Exchange an Idea, we have TWO each. |
 |
|
|
jonasalbert20
Constraint Violating Yak Guru
300 Posts |
Posted - 2004-10-29 : 03:14:36
|
| hgorijal pls post how?Want Philippines to become 1st World COuntry? Go for World War 3... |
 |
|
|
hgorijal
Constraint Violating Yak Guru
277 Posts |
Posted - 2004-10-29 : 05:04:36
|
| update A set siQueueCode = B.qQueueCode, siPrice = B.qPrice, siItem = C.Itemfrom tblStockLocal A, (select top 1 * from tblStockQueue where qStockCode = 'S2004J8001' order by qPriority) B,tblStocks Cwhere A.siStockCode = B.qStockCode and A.siStockCode = C.StockCode and A.siStockCode = 'S2004J8001' Hemanth GorijalaBI Architect / DBA...(yuhoo!!! and now, an "Yak Master")Exchange a Dollar, we still have ONE each.Exchange an Idea, we have TWO each. |
 |
|
|
|
|
|
|
|