Questions tagged [pivot]

This tag is for questions that deal with PIVOT syntax which converts row data into columnar data. This technique is commonplace when collecting one-to-many rows from tables such as Joomla's `#__fields_values`.

Filter by
Sorted by
Tagged with
1 vote
1 answer
30 views

Joomla mysql query - group_contact

I have mysql query: // Get a db connection. $db = JFactory::getDbo(); // Create a new query object. $query = $db->getQuery(true); $formId = 21; $query = "select * from #...
user avatar
  • 73
2 votes
1 answer
95 views

How to join custom fields data to users table without extra rows in result set

I have rudimentary knowledge of SQL (when it comes to anything but single tables) and am trying to come up with a query that will give me all the custom fields for my users. This query will give me ...
user avatar
1 vote
1 answer
30 views

PieChart For RSForm for PlotaLot based on a dropdown field

So I got this Pie Chart to display the Count of Voters vs Position and it's working fine. SELECT Position, COUNT(1) AS count FROM ( SELECT MAX(IF(FieldName = 'Position', FieldValue, NULL)) ...
user avatar
1 vote
1 answer
78 views

Show article fields in module

I have two custom fields in my article for longitude and latitude. I'm then trying to build a module to get these two fields from the current article displayed and show in the module. I have the ...
user avatar
  • 1,992
1 vote
1 answer
102 views

Create Plotalot chart from RSForm Pro data using pivot query

I'm trying to extract RSForm Pro form data from the database to create Plotalot charts. There is a field on the form called "resolved" to which users respond "Yes or No". I would ...
user avatar
  • 13
1 vote
3 answers
182 views

Join #__content with #__fields_values then filter and sort using #__fields_values data

I wrote an override in Joomla 3.X and sorted the result from the DB using this query, which works: $query = "SELECT content.*, fieldvalues.* FROM #__content AS content, #...
user avatar
1 vote
2 answers
93 views

How to count aggregate data from RSForm submission values with Joomla's query building methods?

user SubmissionId FormId FieldName FieldValue bob 2 16 state mystate1 bob 2 16 qda myqad1 bob 2 16 city mycity1 rob 3 16 state mystate2 rob 3 16 qda myqad1 rob 3 16 city mycity1 jac 4 16 state ...
user avatar
  • 43
1 vote
1 answer
111 views

RSFORM combine 2 submission form results in one Plotalot view

After requesting help from local db-masters with no result, I would like to ask this question here. The output required is this for example: Shelter ClientID Year Month Fees Amount ...
user avatar
  • 47
2 votes
1 answer
90 views

PlotALOT RSForm Query showing only one result

After being helped very well by Stack community and learning a bit I created a query to show the sum of payments per client. A client can pay multiple times. I would like to know the sum of payments ...
user avatar
  • 47
1 vote
1 answer
182 views

Charts/Graphs for RSFORM using mysql for VChart and/or PlotaLot

I am working for a homeless organisation in Capetown. We are using RSForms to register our clients (about 3500 per year). We have a sizable database, but it's very hard to create a dashboard. We are ...
user avatar
  • 47
1 vote
1 answer
84 views

How to collect multi-row data from #__fields_values and assign specific aliases for each value in the result set?

I have the following (working) query to get name, username and the value of a custom field: // Get a db connection. $db = JFactory::getDbo(); // Create a new query object. $query = $db->getQuery(...
user avatar
  • 13
3 votes
2 answers
672 views

How to get Custom Fields related to Joomla Content?

I want to know how they get the values of custom user fields within Joomla articles. This is to contribute ideas and ways to solve it.
user avatar
  • 167
2 votes
2 answers
271 views

How to refactor two select queries on RSForm submission data?

I was wondering if anyone could help me JOIN multiple queries into one query. Currently, these 2 blocks of code retrieve information from the DB. I am using the "Sourcerer" plugin to add custom PHP ...
user avatar
  • 155
1 vote
2 answers
117 views

How to re-write sql for joomla JDatabase

I am new to custom Joomla coding so excuse me for this, I want to execute the following statement: "SELECT MAX(CASE WHEN v.FieldName = 'Team_Name' THEN v.FieldValue END) 'Team_Name' , MAX(...
user avatar
  • 11
2 votes
2 answers
447 views

How to retrieve RSForm submission data grouped by SubmissionId?

I have a table with 3 columns: SubmissionId, FieldName and FieldValue. 1) SubmissionId keeps ID submission. 2) FieldName stores field name of a form. 3) FieldValue stores field value of form field. ...
user avatar
2 votes
3 answers
289 views

Joomla 3.3.6 Union SQL Issue

I am having trouble using the union functions in Joomla. This is the SQL I need: SELECT * FROM (SELECT o.title AS org_name, u1.name AS username, 'president' AS `type` FROM ...
user avatar