开发者

How to select lots of counts of lots of different criterias

I'm trying to do a detailed Member Search page. It uses Ajax in every aspect like Linkedin did on search pages.

But I don't know how I can select counts of multiple criterias. You can see what I meant by the attachment. I mean, if I select every count with different queries it's gonna take forever.

Should I store the count values on anot开发者_高级运维her table? Then, further development will be hard and time consuming.

I need your advices.

In this web site, you enter just a keyword and it shows you the all available fields order by count DESC;

How to select lots of counts of lots of different criterias


You can create an Indexed View that groups by your criteria and uses COUNT_BIG to get totals.

CREATE VIEW dbo.TagCount
WITH SCHEMABINDING
AS
    SELECT Tag, COUNT_BIG(*) AS CountOfDocs
    FROM dbo.Docs
    GROUP BY Tag
GO

CREATE UNIQUE CLUSTERED INDEX IX_TagCount ON dbo.TagCount (Tag)
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜