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
 SQL Server Development (2000)
 Group by clause

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-01-31 : 21:29:27
mala writes "Hi,

I have to write a query where three tables are involved. I have written join
statement which is giving required result. But now have to group it on only two
fields . But I con't use distinct or group by clause
as you know it will affect all the columns in the select list.
For eg. the query looks as below and I have to group only on i_partno and inv_zone.


select a.i_partno,a.inv_batch,a.inv_zone,b.i_cyc_abcd,c.i_pvdt,
a.inv_wh_from,a.inv_stkcatg,a.inv_bu,a.inv_area,a.inv_location
from t_inv_Details a,m_materials b,m_mat_Stock c
where a.i_partno=b.i_partno and b.i_partno= c.i_partno
and c.I_PVDT < getdate() and (a.inv_Tqty - a.inv_Sqty) > 0
order by b.i_cyc_Abcd,c.i_pvdt

Pleaselet me know how can I modify this query to get the desired result.

Bye,

Mala
"
   

- Advertisement -