why cant I more than two values from 3 different tables in one query
Posted
by zurna
on Stack Overflow
See other posts from Stack Overflow
or by zurna
Published on 2010-03-23T04:35:32Z
Indexed on
2010/03/23
4:41 UTC
Read the original article
Hit count: 336
asp-classic
|sql-server-2005
This is strange. In the news details page, I want to take a few different values from different tables with one query. However, for some strange reason, I only get two values back. So the outcome is like:
<rows>
<row id="4">
<FullName>Efe Tuncel</FullName>
<CategoryName/>
<Title>Runway Report</Title>
<ShortDesc/>
<Desc></Desc>
<Date/>
</row>
</rows>
If I disable fullname, then I get shortdesc but not others. Same things happens with others.
NewsID = Request.QueryString("NEWSID")
SQL = "SELECT N.NewsID, N.MembersID, N.CategoriesID, N.ImagesID, N.NewsTitle, N.NewsShortDesc, N.NewsDesc, N.NewsActive, N.NewsDateEntered, C.CategoriesID, C.CategoriesName, M.MembersID, M.MembersFullName"
SQL = SQL & " FROM News N, Categories C, Members M"
SQL = SQL & " WHERE N.NewsID = "& NewsID &" AND N.NewsActive = 1 AND N.MembersID = M.MembersID AND N.CategoriesID = C.CategoriesID"
Set objViewNews = objConn.Execute(SQL)
With Response
.Write "<?xml version='1.0' encoding='windows-1254' ?>"
.Write "<rows>"
End With
With Response
.Write "<row id='"& objViewNews("NewsID") &"'>"
.Write "<FullName>"& objViewNews("MembersFullName") &"</FullName>"
.Write "<CategoryName>"& objViewNews("CategoriesName") &"</CategoryName>"
.Write "<Title>"& objViewNews("NewsTitle") &"</Title>"
.Write "<ShortDesc>"& objViewNews("NewsShortDesc") &"</ShortDesc>"
.Write "<Desc><![CDATA["& objViewNews("NewsDesc") &"]]></Desc>"
.Write "<Date>"& objViewNews("NewsDateEntered") &"</Date>"
.Write "</row>"
End With
With Response
.Write "</rows>"
End With
objViewNews.Close
Set objViewNews = Nothing
© Stack Overflow or respective owner