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.
Author |
Topic |
vravo
Starting Member
13 Posts |
Posted - 2008-08-15 : 12:41:53
|
I have two tables and the first table has Drop down values and the second tables has a text field and the drop down selection is unfortunatly is just inserted into the middle of text field... there is at least 30 selections in the first table that belong to the drop down list and I want to count the number of times the drop down categories are used in the textfield in the other table... there is no link between the 2 tables... I didn't create this but need to generate a report from it.Table DDV---------DDV_ID DDV_Index DDV_Value10(subject) 1 Intial Meeting10 2 Follow up Meeting10 3 Product ReviewTable Comments---------------Company_ID DateTime UserId Comments1234567890 2008-08-01... smithJ Stop by for a vist....Subject:Follow up Meeting0987654321 2008-08-02... JonesR Called customer....Subject:Product Reviewwhat I'm looking For!!!Result query-----------------------Subject CountIntial Meeting 19Follow up Meeting 12Product Review 26 I can do a like statement and pull a count individually or hard code then but that's not efficent!! Thanks in advance for any help....ThanksVin |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-15 : 12:51:52
|
may be this?SELECT d.DDV_Value,COUNT(c.Company_ID)FROM DDV dINNER JOIN Comments cON c.Comments LIKE '%'+ d.DDV_Value + '%'GROUP BY d.DDV_Value |
 |
|
vravo
Starting Member
13 Posts |
Posted - 2008-08-15 : 14:22:51
|
Perfect!!!! Thank you!!!!ThanksVin |
 |
|
|
|
|