SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 With my select query how to also get a count
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Aged Yak Warrior

567 Posts

Posted - 11/24/2012 :  15:46:31  Show Profile  Reply with Quote
I am using the following query, i want to see the count. to see how many rows came as a result
select p_al.alias PatID,e_al.alias VisitID, enc.location_cd as LocID,
(select display from code_value where enc.location_cd=code_value.code_value and code_value.code_set=220 and 
code_value.active_ind=1) as ServLocName,enc.med_service_cd MedGrpID,
(select display from code_value where enc.med_service_cd=code_value.code_value and code_value.code_set=34 and 
code_value.active_ind=1) as MedGrpName,
(select display from code_value where enc.encntr_type_cd=code_value.code_value and code_value.code_set=71 and 
code_value.active_ind=1) as PatType,
prsnl_Al.Alias as ProviderID
from encounter enc 
inner join person_alias p_al on (enc.person_id = p_al.person_id and p_al.person_alias_type_cd=10 )
inner join encntr_alias e_al on(enc.encntr_id = e_al.encntr_id and e_al.encntr_alias_type_cd=1077) 
inner join
encntr_prsnl_reltn e_prnl_r on (enc.encntr_id = e_prnl_r.encntr_id and e_prnl_r.encntr_prsnl_r_cd = 1119 and 

e_prnl_r.active_ind=1 and e_prnl_r.manual_create_ind=0)
inner join prsnl_alias prsnl_al on (e_prnl_r.prsnl_person_id = prsnl_al.person_id and 

where enc.active_ind=1 and enc.reg_dt_tm BETWEEN to_date('10/01/2012', 'MM/DD/YYYY') AND  to_date('10/31/2012', 


Thanks a lot for the helpful info.

Flowing Fount of Yak Knowledge

7174 Posts

Posted - 11/24/2012 :  19:34:22  Show Profile  Reply with Quote
How About Select @@ROWCOUNT
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000