Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 With my select query how to also get a count

Author  Topic 

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2012-11-24 : 15:46:31
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

prsnl_al.alias_pool_cd=683988)
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',

'MM/DD/YYYY')

Thanks a lot for the helpful info.

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2012-11-24 : 19:34:22
How About Select @@ROWCOUNT
Go to Top of Page
   

- Advertisement -