• Post Reply Bookmark Topic Watch Topic
  • New Topic

UPDATE with select statment

 
sam liya
Ranch Hand
Posts: 1246
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

eno name phone
----------- -------------------- ----------
1 Quick and Dirty 1112223333
2 Starve Bucks 1112224444
3 JeffyGrease 1114443333
4 Stuffed Stuff 1112225555

RecommendedList
eno eateryname phone
----------- -------------------- ----------
4 Stuffed Stuff 7772225555
11 Pleasant Regrets 9992223333
12 Try Harder 8882224444
23 BBB's Choice 1114443333
1 Quick and Dirty 8882223333

" UPDATE Eateries SET Eateries.phone =
(SELECT x.phone from RecommendedList x WHERE x.eno=Eateries.eno)
WHERE Eateries.eno IN (SELECT eno FROM RecommendedList)
Referring to tables Eateries and RecommendedList in the scenario above, how many Eateries records are updated by the statement? "



the answer is 0.i can't fine how it comes ti zero.
 
Ranjan Barua
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Aruna,

i have checked your query with given data, but it returns me outout "2 rows updated".

please try it again, i think there is something wrong with your tool which you are using.
 
sam liya
Ranch Hand
Posts: 1246
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it can't be happen no.isn't any error in this statments?
 
Ranjan Barua
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No there is no problem with your statement.
 
sam liya
Ranch Hand
Posts: 1246
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ya ,finally i got it .but i got 2 rows.

 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!