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 2000 Forums
 Transact-SQL (2000)
 how do you count this query?

Author  Topic 

simonchia
Starting Member

11 Posts

Posted - 2004-08-09 : 02:22:22
select a.ins_id, a.frcst_altr_id, wh.wh_id, b.ins_1st_cnt_dt, b.ins_2nd_cnt_dt, b.ins_st_cnt_dt, b.ins_pos_cnt_dt from ins_product as a
inner join ins_country as b on a.ins_id = b.ins_id, warehouse as wh
where a.ins_id = '100001' and b.disti_ctry_id = 81 and wh.disti_id = 81009 and (ins_1st_cnt_dt <> '' or ins_2nd_cnt_dt <> '' or ins_2nd_cnt_dt <> '' or ins_pos_cnt_dt <> '')

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2004-08-09 : 02:30:18
1, 2, 3 ....

What exactly are you asking?

Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-08-09 : 03:29:07
this query looks very familiar :)))
well you could do
select count(*), a.ins_id, a.frcst_altr_id, wh.wh_id, b.ins_1st_cnt_dt, b.ins_2nd_cnt_dt, b.ins_st_cnt_dt, b.ins_pos_cnt_dt...
which will give you the number of rows that you have in the query if that's what u need....

Go with the flow & have fun! Else fight the flow :)
Go to Top of Page

simonchia
Starting Member

11 Posts

Posted - 2004-08-09 : 04:46:26
does it?

anyway, i;ve tried that earlier.. not working
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-08-09 : 07:08:16
yeah the (ins_1st_cnt_dt <> '' or ins_2nd_cnt_dt <> '' or ins_2nd_cnt_dt <> '' or ins_pos_cnt_dt <> '') part looks familiar :)
you were asking about performance or simplicity... :))

so what exactly do you want to count??

select count(a.ins_id), a.ins_id, a.frcst_altr_id, ... doesn't work??
for use of count you need a group by

select @@rowcount agter the query will give you the rowcount of the query.


Go with the flow & have fun! Else fight the flow :)
Go to Top of Page
   

- Advertisement -