开发者

Generating report from two separate tables using visual studio

开发者 https://www.devze.com 2023-04-13 05:26 出处:网络
I\'ve got a table(concepttable) w开发者_如何学Chich has stored emotions in conceptname column such as happy sad etc. Users can add more emotions in it via asp web form.

I've got a table(concepttable) w开发者_如何学Chich has stored emotions in conceptname column such as happy sad etc. Users can add more emotions in it via asp web form. In the same dataset there is another table called (blog) that has a string of multiple blog entries with there entry dates.

How would i go around by using a service report to use a droplist that displays the stored emotions in (conceptname) and then shows how many times that selected emotion such as sad has appeared in all blogcontent strings in the blog table?

Any help is appreciated, I've been trying blindly using joins and full text searches but am not certain what way to go around to achieve this. Ive attached an image showing the data sources.

Generating report from two separate tables using visual studio

The output i want to achieve is a chart similar to this:

Generating report from two separate tables using visual studio

Sorry if this is vague, add a comment if your not sure what i mean. Thanks for any help!


Here is the SQL you need:

select conceptName,COUNT(distinct blogId) as Tot
from conceptTable ct
join blogs on content like '%'+ct.conceptName+'%'
group by conceptName

To get the first date a concept appears

select conceptName,min(inputDate) as FirstTime,COUNT(distinct blogId) as Tot
from conceptTable ct
join blogs on content like '%'+ct.conceptName+'%'
group by conceptName

To get the most recent date a concept appears

select conceptName,max(inputDate) as MostRecent,COUNT(distinct blogId) as Tot
from conceptTable ct
join blogs on content like '%'+ct.conceptName+'%'
group by conceptName

To get all dates

select conceptName,inputDate,COUNT(distinct blogId) as Tot
from conceptTable ct
join blogs on content like '%'+ct.conceptName+'%'
group by conceptName,inputDate
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号