{"id":4109,"date":"2008-01-22T20:54:05","date_gmt":"2008-01-23T04:13:53","guid":{"rendered":"http:\/\/www.amptoons.com\/blog\/archives\/2008\/01\/22\/bleg-help-me-solve-this-sql-access-database-problem-please-win-a-cartoon\/"},"modified":"2008-01-22T20:54:05","modified_gmt":"2008-01-23T04:13:53","slug":"bleg-help-me-solve-this-sql-access-database-problem-please-win-a-cartoon","status":"publish","type":"post","link":"https:\/\/amptoons.com\/blog\/?p=4109","title":{"rendered":"Bleg: Help me solve this SQL \/ Access database problem please! Win a cartoon!"},"content":{"rendered":"<p>I&#8217;m having a database problem at work that I don&#8217;t know enough to fix. If any &#8220;Alas&#8221; readers who know database stuff can glance at this and tell me if they see what my problem is &#8212; my problem involving the database, that is, I may have many non-database-related issues that there&#8217;s no need to bring up at this moment &#8212; I&#8217;d appreciate it.<\/p>\n<p>Heck &#8212; I&#8217;ll do a cartoon of any celebrity or any &#8220;Hereville&#8221; character of your choice to anyone who fixes the problem!<\/p>\n<p><!--more--><\/p>\n<p>So at my workplace, <a href=\"http:\/\/www.oldchurch.org\">a nonprofit historic site<\/a>, we use Microsoft Access to keep track of donations and addresses.<\/p>\n<p>Today, we want to output a list of everyone who hasn&#8217;t given us money since August 1 2007. To do this, we use a query that looks like this (for posting on &#8220;Alas,&#8221; I&#8217;ve replaced ( with { and ) with }, because posting double-parenthesis in &#8220;Alas&#8221; leads to difficulties. But in the real thing I&#8217;m using parenthesis):<\/p>\n<blockquote><p>SELECT Members.Zip, Members.[First name], Members.[Last name], Members.[Address 1], Members.[Address 2], Members.City, Members.State<br \/>\nFROM Members<br \/>\nWHERE {{{Members.Zip}>&#8221;0&#8243;} AND {{Members.MemberID} Not In {SELECT Gifts.MemberID FROM Gifts GROUP BY Gifts.MemberID HAVING MAX{Gifts.Date} >= #01\/14\/08# }} AND {{Members.Deceased}<>Yes} AND {{Members.[No Mail]}<>Yes} AND {{Members.Retirement}<>Yes} AND {{Members.[No Begging]}<>Yes}}<br \/>\nORDER BY Members.Zip, Members.[Last name];\n<\/p><\/blockquote>\n<p>I have no idea how to use this stuff, but this is a query that I&#8217;ve used many times in the past, and all I have to do is change the date and it works. Until today.<\/p>\n<p>Today, for some reason, it won&#8217;t work for dates before 01\/14\/08. If I input 01\/14\/08, it appears to correctly output a list of every member who hasn&#8217;t donated money since the 14th {which is to say, pretty much all of them}. But any date earlier than that &#8212; such as 01\/13\/08 or the date I want to use, 08\/01\/07 &#8212; and it outputs a blank list, indicating that absolutely all of our members have given money since that date. {We&#8217;d be happy if that were so, but alas, it&#8217;s not so.}<\/p>\n<p>Oddly enough, another query I use &#8212; this time to tell me everyone who HAS given us money since August 1 2007, plus the retirement homes on our mailing list &#8212; seems to be working perfectly. Here&#8217;s what that one looks like:<\/p>\n<blockquote><p>\nSELECT Members.Zip, Members.[First name], Members.[Last name], Members.[Address 1], Members.[Address 2], Members.City, Members.State<br \/>\nFROM Members<br \/>\nWHERE {{{Members.Zip}>&#8221;0&#8243;} AND {{Members.MemberID} In {SELECT Gifts.MemberID FROM Gifts GROUP BY Gifts.MemberID HAVING MAX{Gifts.Date} >= #08\/01\/07# }} AND {{Members.Deceased}<>Yes} AND {{Members.[No Mail]}<>Yes}} OR {{{Members.Retirement}=Yes}}<br \/>\nORDER BY Members.Zip, Members.[Last name];<\/p><\/blockquote>\n<p>To qualify as having &#8220;solved&#8221; my problem, you have to explain it to me in terms so clear that I&#8217;m capable of getting it working. :-}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m having a database problem at work that I don&#8217;t know enough to fix. If any &#8220;Alas&#8221; readers who know database stuff can glance at this and tell me if they see what my problem is &#8212; my problem involving &hellip; <a href=\"https:\/\/amptoons.com\/blog\/?p=4109\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[92],"tags":[],"class_list":["post-4109","post","type-post","status-publish","format-standard","hentry","category-whatever"],"_links":{"self":[{"href":"https:\/\/amptoons.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4109","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/amptoons.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/amptoons.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/amptoons.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/amptoons.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4109"}],"version-history":[{"count":0,"href":"https:\/\/amptoons.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4109\/revisions"}],"wp:attachment":[{"href":"https:\/\/amptoons.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4109"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/amptoons.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4109"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/amptoons.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4109"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}