TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
sai reddy
NA
18
6.8k
Self join on three columns with conditions
Sep 7 2017 9:52 PM
------This is my query from a single table name called mis_subscription_details
SELECT DISTINCT DATE(created_timestamp) AS DATE,(
SELECT COUNT(*) FROM mis_subscription_details WHERE vastype='rrbt' AND DATE(created_timestamp)=DATE_SUB(CURDATE(), INTERVAL 6 DAY)
) AS Total_Subscription
,
(
SELECT COUNT(*) FROM mis_subscription_details WHERE vastype='RRBTChild' AND DATE(created_timestamp)=DATE_SUB(CURDATE(), INTERVAL 6 DAY)
) AS Total_Tone_Download_New
FROM mis_subscription_details WHERE DATE(created_timestamp)=DATE_SUB(CURDATE(), INTERVAL 7 DAY)
----From the above query i need three columns such as Date, Total_Subscription,Total_Tone_Download_New with joins
Reply
Answers (
5
)
Is it any row uniquely identify is superkey
IN Operator how to use MySQL