SQL Learning Center - GoldMine

Use SQL queries to get answers from GoldMine

May 30, 2008

Counts of Contact Type (key1) for a Specific List of Contact Types

by @ 7:44 am. Filed under MSSQL Counts

Type: MSSQL
Description: This query will give you counts for a list of Contact Types you give it in the WHERE portion

  1.  
  2. SELECT
  3.  COUNT(c1.accountno) AS Investor_Count
  4. ,c1.key4 AS AcctMgr
  5. ,c1.key1
  6. FROM
  7.  contact1 c1 (NOLOCK)
  8. WHERE
  9.  c1.accountno IN (
  10.  SELECT
  11.   c1.accountno
  12.  FROM
  13.   contact1 c1
  14.    JOIN conthist ch
  15.    ON c1.accountno=ch.accountno
  16.  WHERE
  17.   ch.userid = c1.key4
  18.   AND c1.key1 IN (
  19.   'Broker'
  20.  ,'Charity'
  21.  ,'Consultant'
  22.  ,'Corporate Pension'
  23.  ,'Endowment'
  24.  ,'Family Office'
  25.  ,'Foundation'
  26.  ,'High Net Worth'
  27.  ,'Insurance Company'
  28.  ,'Investment Advisor'
  29.  ,'Investment Manager'
  30.  ,'Investor'
  31.  ,'Law Firm'
  32.  ,'Manager'
  33.  ,'Other'
  34.  ,'Pension'
  35.  ,'Prime Broker'
  36.  ,'Private Bank'
  37.  ,'Private Equity'
  38.  ,'Public Pension'
  39.  ,'Trust'
  40.  ,'Union Pension'
  41.  ,'University'
  42.  ,'Wealth Management'
  43.  ,''))
  44. GROUP BY
  45.  c1.key4
  46. ,c1.key1
  47.  
Bookmark:

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • Live
  • Google
  • Facebook
  • bodytext
  • StumbleUpon
  • Slashdot

Leave a Reply

You must be logged in to post a comment.

GoldMine SQL Tutorial:

General SQL Tutorials:

SQL Help Links:

Recommended Reading - SQL Books:

RSS:

Links:

Search For SQL Query:

GoldMine MS SQL Queries:

GoldMine dBase SQL Queries (LocalSQL):

22 queries. 0.074 seconds