<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/1.5.2" -->
<rss version="0.92">
<channel>
	<title>SQL Learning Center - GoldMine</title>
	<link>http://www.crmsql.com</link>
	<description>Use SQL queries to get answers from GoldMine</description>
	<lastBuildDate>Mon, 01 Feb 2010 14:10:28 +0000</lastBuildDate>
	<docs>http://backend.userland.com/rss092</docs>
	<language>en</language>

	<item>
		<title>History - No Notes for Date Range - Version 8.5 forward</title>
		<description>	Type: MSSQL
Description:  History with No Note for Date Range for GoldMine Version 8.5 Forward 
	&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; 
SELECT
&nbsp; ch.REF
&nbsp;,ch.ondate
&nbsp;,CAST&#40;CAST&#40;ch.notes AS VARBINARY&#40;MAX&#41;&#41;AS VARCHAR&#40;MAX&#41;&#41; AS Notes
FROM
&nbsp;conthist ch
WHERE
&nbsp;DATALENGTH&#40;CAST&#40;CAST&#40;notes AS VARBINARY&#40;MAX&#41;&#41;AS VARCHAR&#40;MAX&#41;&#41;&#41; &lt; 1
&nbsp;AND ch.ondate BETWEEN '01/01/2009' AND '12/31/2009' 
&nbsp; &nbsp; &nbsp; &nbsp; 
 </description>
		<link>http://www.crmsql.com/?p=47</link>
	</item>
	<item>
		<title>History - No notes for Date Range for GoldMine Versions previous to 8.5</title>
		<description>	Type: MSSQL
Description:  History with No Note for Date Range for GoldMine before Version 8.5
	&nbsp;
SELECT
&nbsp; ch.REF
&nbsp;,ch.ondate
&nbsp;,ch.notes
FROM
&nbsp;conthist ch
WHERE
&nbsp;DATALENGTH&#40;ch.notes&#41; &lt; 1
&nbsp;AND ch.ondate BETWEEN '01/01/2009' AND '12/31/2009'
&nbsp;
 </description>
		<link>http://www.crmsql.com/?p=46</link>
	</item>
	<item>
		<title>History Activity Counts</title>
		<description>	Type: MSSQL
Description:  Get counts of History Activities by type for a user
	&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; 
SELECT
&nbsp;CASE LEFT&#40;ch.rectype,2&#41;
&nbsp; WHEN 'CO' THEN 'Call Out'
&nbsp; WHEN 'CI' THEN 'Call In'
&nbsp; WHEN 'CC' THEN 'Call Back'
&nbsp; WHEN 'CM' THEN 'Returned Message'
&nbsp; WHEN 'MO' THEN 'Email Out'
&nbsp; WHEN 'MI' THEN 'Email In'
&nbsp; WHEN 'A ...</description>
		<link>http://www.crmsql.com/?p=45</link>
	</item>
	<item>
		<title>More Than Two Matching Company Records Not In OrgChart</title>
		<description>	Type: MSSQL
Description:  More Than Two Matching Company Records Not In OrgChart - We use GoldBox to add contact records automatically to company name based orgcharts. If users enter a record with no value in contact it doesn&#8217;t add the record. We use this to find any records where there ...</description>
		<link>http://www.crmsql.com/?p=43</link>
	</item>
	<item>
		<title>Additional Contact Email</title>
		<description>	Type: MSSQL
Description:  This uses the ISNULL function to correctly bring back emails that fit inside contsupp.contsupref and the longer ones that spill over in to contsupp.address1
	&nbsp;
SELECT
&nbsp;c1.key1
,cs.contact
,ISNULL&#40;cs1.contsupref,''&#41; + ISNULL&#40;cs1.address1,''&#41; AS email
FROM
&nbsp;contact1 c1
&nbsp;JOIN contsupp cs
&nbsp; ON c1.accountno=cs.accountno
&nbsp; JOIN contsupp cs1 ON cs.recid=cs1.linkacct
WHERE
&nbsp;cs.rectype='C'
&nbsp;AND cs1.contact='E-Mail Address'
&nbsp;AND cs1.rectype = 'P' &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; ...</description>
		<link>http://www.crmsql.com/?p=42</link>
	</item>
	<item>
		<title>Call Counts for One or More Users Per Month</title>
		<description>	Type: MSSQL
Description:  Call Counts for One or More Users Per Month
	&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; 
SELECT
&nbsp;ch.userid
,DATENAME&#40;m,ch.ondate&#41; AS Call_Month
,DATEPART&#40;m,ch.ondate&#41; AS Month_Num
,COUNT&#40;*&#41; AS Call_Count
FROM conthist ch
WHERE
&nbsp;ch.userid = 'JSMITH'
&nbsp;AND ch.rectype LIKE 'C%'
&nbsp;AND YEAR&#40;ch.ondate&#41; = '2009'
GROUP BY
&nbsp;ch.userid
,DATENAME&#40;m,ch.ondate&#41;
,DATEPART&#40;m,ch.ondate&#41;
ORDER BY
&nbsp;DATEPART&#40;m,ch.ondate&#41;
&nbsp;
 </description>
		<link>http://www.crmsql.com/?p=41</link>
	</item>
	<item>
		<title>Find Primary Email Addresses for State and Contact Type LIKE</title>
		<description>	Type: MSSQL
Description:  Find Primary Email Addresses for State and Contact Type LIKE (type in whole or partial words between the percent signs)
	&nbsp;
SELECT
&nbsp;c1.contact
,cs.contsupref
,cs.accountno
,c1.lastname
,c1.key1 AS ContType
FROM
&nbsp;contact1 c1
&nbsp;JOIN contsupp cs
&nbsp; ON c1.accountno=cs.accountno
WHERE
&nbsp;cs.contact='E-mail Address'
&nbsp;AND SUBSTRING&#40;cs.zip FROM 2 FOR 1&#41; = '1'
&nbsp;AND c1.STATE IN &#40;'MA'&#41;
&nbsp;AND &#40;c1.key1 LIKE '%Instr%'
&nbsp; &nbsp; &nbsp; OR c1.key1 LIKE '%Stu%'&#41;
ORDER ...</description>
		<link>http://www.crmsql.com/?p=40</link>
	</item>
	<item>
		<title>Contacts where GoldMine userid has more than 5 histories</title>
		<description>	Type: MSSQL
Description:  Contacts where GoldMine userid has more than 5 histories
	&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; 
SELECT
&nbsp;c1.company
,c1.contact
&nbsp;c1.accountno
FROM
&nbsp;contact1 c1
WHERE
&nbsp;c1.accountno IN
&nbsp;&#40;SELECT
&nbsp; &nbsp;accountno
&nbsp; FROM
&nbsp; &nbsp;conthist
&nbsp; WHERE
&nbsp; &nbsp;userid='MASTER'
&nbsp; GROUP BY
&nbsp; &nbsp;accountno
&nbsp; ,userid
&nbsp; HAVING
&nbsp; &nbsp;COUNT&#40;*&#41; &gt; 5&#41;
&nbsp;
 </description>
		<link>http://www.crmsql.com/?p=39</link>
	</item>
	<item>
		<title>Find Malformed Email Addresses</title>
		<description>	Type: MSSQL
Description: Find Malformed Email Addresses
NOTE: Because this query is looking for special characters it doesn&#8217;t display properly in a web page - please cut and paste the text of the query from here: Find Malformed Email Addresses  
	
SELECT
 accountno
,cs.contsupref AS 'E-Mail Address'
FROM
 contsupp cs
WHERE
 (cs.CONTACT = 'E-mail Address')
 ...</description>
		<link>http://www.crmsql.com/?p=38</link>
	</item>
	<item>
		<title>Find all contacts sent a certain attachment</title>
		<description>	Type: MSSQL
Description: Find all contacts sent a certain attachment
	&nbsp;
SELECT
&nbsp;c1.contact
,c1.company
,ch.rectype
,mb.maildate
,c1.accountno
FROM
&nbsp;contact1 c1
&nbsp;JOIN conthist ch
&nbsp;ON c1.accountno=ch.accountno
&nbsp;JOIN mailbox mb
&nbsp; ON ch.recid = mb.linkrecid
WHERE
&nbsp;mb.maildate &gt; '11/01/2007'
&nbsp;AND mb.rfc822 LIKE '%Put attachment filename here%'
&nbsp;
 </description>
		<link>http://www.crmsql.com/?p=37</link>
	</item>
</channel>
</rss>
