通过电子邮件从表中获取用户详细信 [英] Get User Details by Email from Table

查看:84
本文介绍了通过电子邮件从表中获取用户详细信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文章表...用户通过电子邮件ID发布不同类别的文章..

i需要从该表中获取以下信息...



唯一的Emailid以及通过该emailid,类别,每个类别中的帖子数量完成的帖子数量(总帖子数).....



我需要选择具有以上信息的所有唯一的emailid ....



ArticleTB中的字段:

标题,description,Categoryid,EmailId,PostedDate

I have a Article table...The user post the articles in different category by their Email id..
i need to take a following information from that table...

Unique Emailid and how many post(count of total post)done through that emailid, category, No of posts in each category.....

I need to select all unique emailid with above informations....

Fields in ArticleTB :
Title, description, Categoryid, EmailId, PostedDate

推荐答案

根据您的要求,如果您想在单个查询中获取所有这些数据,那么这是不可能的。这背后的原因是,

你首先需要唯一的电子邮件ID,最后你说你想要每个类别中没有帖子,除了你发现的独特类别。逻辑上和自然地,两个独特的东西不能添加到同一行。即使有可能,如果有单个类别或单个电子邮件ID。



如果您理解这一点或您需要的任何其他帮助,请告诉我。
As per your requirement, if you want all this data in single query then thats not possible. Reason behind this is,
You first of all need unique email id and lastly you said that you want 'No of posts in each category', that nothing but your finding unique category. Logically and naturally two unique things can not be added to same row. Even that possible if there single category or single email id.

please let me know if you understand this or any other help you need.

SELECT Title,EmailId,Count(EmailId)as totalads

FROM dbo.ArticleTB

其中PostedDate> DATEADD(dd,-2,GETDATE())和PostedOn< DATEADD(dd,-1,GETDATE())

GROUP BY EmailId,Title;
SELECT Title, EmailId,Count(EmailId) as totalads
FROM dbo.ArticleTB
where PostedDate > DATEADD(dd, -2, GETDATE()) AND PostedOn < DATEADD(dd, -1, GETDATE())
GROUP BY EmailId,Title;


这篇关于通过电子邮件从表中获取用户详细信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆