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)
 complex select query

Author  Topic 

dreamaboutnothing
Starting Member

47 Posts

Posted - 2004-10-13 : 21:08:19
Hi Guys,
would you be kind enough to help me in resolving this complex select query.I have 3 tables.one non flattened but don't worry i have flattened it.
Table 1 Gen_companies, column required company name
Table 2 Gen_individuals,column required individual name who advertised but not a company
Table 3 di_webclick_statistics (which i flattened)

Code is like this:
select substring(','+ display_name_id +',', ID,
CharIndex(',',','+ display_name_id + ',', ID)-ID)As display_Name_Id from Di_Tally,di_webclick_statistics
where display_name_id!='0'
and ID <=Len(',' + display_name_id +',')
and substring(',' + display_name_id +',', ID-1, 1)=','
and ID<=Len(',' + display_name_id +',')
AND CharIndex(',' , ',' +display_name_id + ',' , ID) - ID > 0

output should look like:

Advertisers |count
A | 45
B | 12

Thank you in advance

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2004-10-13 : 22:29:33
how about some ddl and dml?

--------------------
keeping it simple...
Go to Top of Page
   

- Advertisement -