Welcome to Forums Sign in | Join | Help | Forums
in Search


Querying based on a count

Last post 01-27-2009 10:04 AM by Melissa Graves. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 01-20-2009 5:42 AM

    • Peter Davis
    • Top 500 Contributor
    • Posts 35
    • Organization: Bangor University
    • Products:  The Raiser's Edge

    Querying based on a count

    Is there a method, without having to export and manipulate data externally, to select records based on how many of something the record has?

    In MySQL, I'd use something like this for selecting records that have more than one of a given attribute:

    SELECT attr, COUNT(attr) AS cnt FROM table GROUP BY attr HAVING cnt > 1

    But it appears that if I base a query on an attribue, it gives me fixed options (blank, not blank, contains, ..), but no real power to query it further than that.

    Thanks,
    Pete 

  • 01-21-2009 7:35 PM In reply to

    • Nicholai Burton
    • Top 75 Contributor
    • User Since: 2004
    • Posts 92
    • Organization: Blackbaud, Inc
    • Products:  Blackbaud Direct Marketing, Blackbaud Enterprise CRM, The Patron Edge, The Raiser's Edge

    Re: Querying based on a count

    If you have a certain maintenance level on RE (I think it's advantage professional), you can get an unlock code for RE:Open, which is read-only database access.  This gives you the ability to write much more advanced queries (in MSSQL syntax) to meet your needs.  The regular query module has some ability to query on count but only for specific items, like total number of gifts. Hope this helps!

  • 01-22-2009 6:17 AM In reply to

    Re: Querying based on a count

    Could you use pivot reports for this?  If you build your query and create a pivot report you should be able to get a count from there. Hope this helps!

     

    Charlotte

     

    Charlotte Ory
    Raisers Edge Consultant and Trainer

    07834 407 858
    charlotte@charlotteoryconsulting.co.uk
    www.charlotteoryconsulting.co.uk
  • 01-22-2009 6:45 AM In reply to

    • Peter Davis
    • Top 500 Contributor
    • Posts 35
    • Organization: Bangor University
    • Products:  The Raiser's Edge

    Re: Querying based on a count

    Brilliant, thanks for getting back to me.

    The only downside I can see to the pivot report option is that it won't let me use that data within, say, Mail.

    I'll look into both of these suggestions.

    Thanks again :)
     

  • 01-22-2009 10:11 AM In reply to

    • Mark Zarbailov
    • Top 100 Contributor
    • User Since: 2000
    • Posts 77
    • Organization: Ethical Culture Fieldston School
    • Products:  Blackbaud NetCommunity, Online Campus Community, The Education Edge, The Financial Edge, The Raiser's Edge, The Researcher's Edge

    Re: Querying based on a count

    Fire up MS-Query Analyzer or SQL Server Management Studio to write a query,

    You would need to reference to your table to the following tables:

     dbo.AttributeTypesdbo.CODETABLES dbo.TABLEENTRIES 

    to find what you are looking for.

     

    Mark.

     

    Mark Zarbailov
    Director of Database Services
    Ethical Culture Fieldston School
    212-712-6240
    Filed under:
  • 01-22-2009 10:23 AM In reply to

    • Peter Davis
    • Top 500 Contributor
    • Posts 35
    • Organization: Bangor University
    • Products:  The Raiser's Edge

    Re: Querying based on a count

    Hi Mark,

    Thanks for your input on this, and I do have access to the SQL Server console, but it still leaves me unable to perform functions natively within RE and pass the results through to other parts of RE. Mail being the simplest example.

    I'll keep plugging away :)
     

  • 01-22-2009 11:04 AM In reply to

    • Wayne Tarr
    • Not Ranked
    • User Since: 2004
    • Posts 5
    • Organization: Breast Cancer Care
    • Products:  Blackbaud Enterprise CRM, The Raiser's Edge

    Re: Querying based on a count

    If you have the VBA module enabled you can use the VBA User Field of Query or Export. See KB article BB59638 for an example in Export (change the parameter IBBExportRow to IBBQueryRow for this to work in Query). Then you can use ADO or similar to query the SQL database directly from VBA and pass the result back into RE.

    Regards
    Wayne

  • 01-27-2009 9:37 AM In reply to

    • Peter Davis
    • Top 500 Contributor
    • Posts 35
    • Organization: Bangor University
    • Products:  The Raiser's Edge

    Re: Querying based on a count

    Excellent, thanks guys.

    I think I've arranged to have access to RE:Open now, which ought to help with what I need.

    Do you know if the VBA bundle comes along with RE:Open? 

  • 01-27-2009 10:04 AM In reply to

    Re: Querying based on a count

    No

    RE:Open you can get for free with certain maintainance agreements.  The VBA module will run you into the 5 figures for cost.

    Melissa S. Graves
    Annual Fund Development Services Manager
    Pathfinder International
Page 1 of 1 (9 items)