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 |
|
shapper
Constraint Violating Yak Guru
450 Posts |
Posted - 2007-05-01 : 11:58:13
|
| Hello,I am creating a record set as follows:DECLARE @tArticles TABLE (PostId UNIQUEIDENTIFIER)INSERT INTO @tArticlesSELECT a.ArticleId FROM Articles aSELECT c.ArticleID, c.CommentID, c.CommentText, c.CommentAuthorIdFROM @tArticles taINNER JOIN Comments c ON ta.ArticleId = c.ArticleIDNow for each comment I want to get the author name and email from the table users (Every comment has an author). I did the following:SELECT c.ArticleID, c.CommentID, c.CommentText, c.CommentAuthorId, u.Username, u.UseremailFROM @tArticles taINNER JOIN Comments c ON ta.ArticleId = c.ArticleIDINNER JOIN Users u ON c.CommentAuthorId = u.UserIdCan I do this?"INNER JOIN Users u ON c.CommentAuthorId = u.UserId"Thank you,Miguel |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-05-01 : 12:02:24
|
| Yes. You can do it.Are you getting any error?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
shapper
Constraint Violating Yak Guru
450 Posts |
Posted - 2007-05-01 : 12:19:31
|
| I was getting an error on my procedure END. I though it was because of this ... i wasn't sure if I could do it. But know I found the error was somewhere else. I don't understand why SQL sometimes gives me the error on the code line and others on END line.Thank You,Miguel |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-05-01 : 16:59:22
|
| It depends.First of all what the error really says.Peter LarssonHelsingborg, Sweden |
 |
|
|
|
|
|