CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Alpha and Beta Release Testing »
  • Table convention query
Pages: [1]

Author Topic: Table convention query  (Read 6074 times)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Table convention query
March 16, 2008, 12:44:52 am
Hi there,

I have been trying to write an SQL query and one field confuses me (well many actually but just one I'm focussed on right now):

`civicrm_contribution`.`payment_instrument_id`

has the description:

FK to Payment Instrument

In other fields with similar descriptions the related field has been the ID field in the table of that name (prepended with civicCRM_) but not in this case so I'm struggling to find the related field.


Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Table convention query
March 16, 2008, 07:15:44 pm
That column is actually keyed to the civicrm_option_value.value - which is where many of the DB stored "enums" are stored.

The option_value rows are grouped by civicrm_option_group.id - each "option group". Payment instruments are have group id of 10. So - you find all of them with:

SELECT *
FROM `civicrm_option_value`
WHERE option_group_id =10

... and add in "value = $yourValue" to get a specific payment instrument for a contribution.
Protect your investment in CiviCRM by  becoming a Member!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Alpha and Beta Release Testing »
  • Table convention query

This forum was archived on 2017-11-26.