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
 General SQL Server Forums
 New to SQL Server Programming
 How should I modify my simple select query?

Author  Topic 

Topaz
Posting Yak Master

199 Posts

Posted - 2011-02-22 : 09:36:16
How can I modify the select query to lookup more than just the website field?

SELECT website, count(acc_ref) as acc_ref
from wce_contact
with (nolock) where acc_ref is not null and batch like 351
group by website

I thought that if I to use this query it would show me the results but selecting the extra fields?

SELECT website, email, company count(acc_ref) as acc_ref
from wce_contact
with (nolock) where acc_ref is not null and batch like 351
group by website

SQL produces a weird error. Can somebody please help.

Thanks


JT

chris_n_osborne
Starting Member

34 Posts

Posted - 2011-02-22 : 09:43:59
Change:

group by website

To:

group by website, email
Go to Top of Page

Topaz
Posting Yak Master

199 Posts

Posted - 2011-02-22 : 09:48:13
That worked a treat. Thanks!

JT
Go to Top of Page
   

- Advertisement -