ozimandius
Programmer
The MainTable.Descrption field is a MEMO field but the straight forward query below only returns the first 256 characters from the Description field. Any ideas why?
The MainTable table to Comments table is a 1 to many relationship, and I am trying to capture the count of the Comments for each item in MainTable.
SELECT top 25 MainTable.Description, MainTable.Counter, MainTable.EntryDate, MainTable.URL, MainTable.TagLine, MainTable.Category, MainTable.ImageLink, MainTable.ImagePercentage, MainTable.UserName, MainTable.Aproved, Count(Comments.StoryID) AS CountOfStoryID
FROM MainTable LEFT JOIN Comments ON MainTable.Counter = Comments.StoryID
GROUP BY MainTable.Counter, MainTable.EntryDate, MainTable.URL, MainTable.TagLine, MainTable.Description, MainTable.Category, MainTable.ImageLink, MainTable.ImagePercentage, MainTable.UserName, MainTable.Aproved
ORDER BY MainTable.EntryDate desc, MainTable.Counter, MainTable.URL, MainTable.TagLine, MainTable.Description, MainTable.Category, MainTable.ImageLink, MainTable.ImagePercentage, MainTable.UserName, MainTable.Aproved;
Without the GroupBy part, I get an error saying I need to use "Description as part of an agragate function", but once that's in place it concatonates the Description field. Removing the GroupBy clause and the Count(Comments.StoryID) AS CountOfStoryID gives me the Description field in total. How else can I get all the information in a single query?
The MainTable table to Comments table is a 1 to many relationship, and I am trying to capture the count of the Comments for each item in MainTable.
SELECT top 25 MainTable.Description, MainTable.Counter, MainTable.EntryDate, MainTable.URL, MainTable.TagLine, MainTable.Category, MainTable.ImageLink, MainTable.ImagePercentage, MainTable.UserName, MainTable.Aproved, Count(Comments.StoryID) AS CountOfStoryID
FROM MainTable LEFT JOIN Comments ON MainTable.Counter = Comments.StoryID
GROUP BY MainTable.Counter, MainTable.EntryDate, MainTable.URL, MainTable.TagLine, MainTable.Description, MainTable.Category, MainTable.ImageLink, MainTable.ImagePercentage, MainTable.UserName, MainTable.Aproved
ORDER BY MainTable.EntryDate desc, MainTable.Counter, MainTable.URL, MainTable.TagLine, MainTable.Description, MainTable.Category, MainTable.ImageLink, MainTable.ImagePercentage, MainTable.UserName, MainTable.Aproved;
Without the GroupBy part, I get an error saying I need to use "Description as part of an agragate function", but once that's in place it concatonates the Description field. Removing the GroupBy clause and the Count(Comments.StoryID) AS CountOfStoryID gives me the Description field in total. How else can I get all the information in a single query?