June 22, 2012 at 8:19 am
Hi there!
I'm trying to get the last update statement to work and it is not work for me. I receive errors on the join. Any help appreciated!
Results I'm looking for should have the select from the random the same as the last select from the updated table. 🙁
DECLARE @random TABLE
(Name varchar(200))
INSERT INTO @random (Name)
SELECT TOP 10 name FROM teamassignment ORDER BY NEWID() ;
Select * from @random
Update Enrollment
Set TeamGIF = (Select pic from Teams where Animal='AnimalName')
from Enrollment
inner join @random R
on E.FullName=R.Name
Where --exists (Select Name from @random)
teamassisgnment.volunteer is null
Select distinct FullName from Enrollment
Where teamgif=(Select pic from Teams where Animal='AnimalName')
¤ §unshine ¤
June 22, 2012 at 8:23 am
sunshine-587009 (6/22/2012)
Hi there!I'm trying to get the last update statement to work and it is not work for me. I receive errors on the join. Any help appreciated!
Results I'm looking for should have the select from the random the same as the last select from the updated table. 🙁
DECLARE @random TABLE
(Name varchar(200))
INSERT INTO @random (Name)
SELECT TOP 10 name FROM teamassignment ORDER BY NEWID() ;
Select * from @random
Update Enrollment
Set TeamGIF = (Select pic from Teams where Animal='AnimalName')
from Enrollment
inner join @random R
on E.FullName=R.Name
Where --exists (Select Name from @random)
teamassisgnment.volunteer is null
Select distinct FullName from Enrollment
Where teamgif=(Select pic from Teams where Animal='AnimalName')
ddl? sample data? You say errors...what are they? What exactly are you trying to do?
You where clause is referencing "teamassisgnment.volunteer" but that table is not in the query.
You have been around here long enough to know that we need some details to work with.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
June 22, 2012 at 12:28 pm
Wow! I never finished writing the messsage and must have accidentally sent because I got busy at work. I am a dba, not a developer which is why I am asking for assistance. Once I finish my tasks here and figure out how to get your "ddl", I will add. I apologize.
Thanks for the clarification.
S
¤ §unshine ¤
June 22, 2012 at 12:50 pm
sunshine-587009 (6/22/2012)
Wow! I never finished writing the messsage and must have accidentally sent because I got busy at work. I am a dba, not a developer which is why I am asking for assistance. Once I finish my tasks here and figure out how to get your "ddl", I will add. I apologize.Thanks for the clarification.
S
No worries, didn't mean to sound as snippy as it did rereading. 😉 Take a peek at the first link in my signature for best practices when posting questions. It explains what to post and how to best put it together.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply