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
narasiman rao
NA
519
771.7k
Combining the two sql queries
Jul 11 2015 7:51 AM
First query as follows
select cmn_minor_code as Course_Name, convert(char,cbm_batch_start_dt,106) as Course_date, cbm_batch_id as Batch_ID
from co_batch_master
where cbm_active <. 'd'
and cbm_batch_start_dt between convert(datetime,'06-Jul-2015',6)
and convert(datetime,'06-Jul-2015',6) order by cbm_batch_start_dt
When i run the first query output as follows
Course_Name Course_date Batchid
AFF 12 jun 2015 B8753
Second query as follows
select count(*) as No_of_students
from student s,course_registration cr,batch_course_registration bcr,co_batch_master cbm where cr.stud_id = s.stud_id and cr.cr_bill_no = bcr.cr_bill_no and bcr.bcr_batch_id = cbm.cbm_batch_id and cbm.cbm_active <> 'D' and cr.cr_active = 'A' and s.stud_active <>'D' and cbm_batch_id = 'B8753'
When i run the second query output as follows
No_of_students
24
I want to combine the first query and second query and output i want as follows
Course_Name Course_date Batchid No_of_students
AFF 12 jun 2015 B8753 24
Reply
Answers (
1
)
Scheduling Jobs in SQL Server Express with Advanced Features
How to convert negative time span to positive in SQL server