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 2005 Forums
 Transact-SQL (2005)
 Select from table based on another table..

Author  Topic 

dnf999
Constraint Violating Yak Guru

253 Posts

Posted - 2007-02-05 : 06:51:41
Hi I'm trying to select data from a table based on a group by of antoher table, but am having errors with the script:

select * from table1
where field1 in
(select field1, field2 from table2
where field1 = 'yes'
group by field1, field2
having count(*) > 1)

I don't know how I can adjust the code so that it bases my selection from the group by on table2...

Thanks in advance!

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-02-05 : 06:58:01
You can't do this. You can't have multiple column return in a sub query.

Can you explain what are you trying to achieve ? Perhaps with some sample data and required result ?


KH

Go to Top of Page
   

- Advertisement -