Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 12352

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`.

1 vote

Joomla 3.3.6 Union SQL Issue

A few points: You have really made a rod for your back by not "normalizing" your org table. My strong recommendation is to restructure your org table to have a type column versus three static colum …
mickmackusa's user avatar
  • 4,846
1 vote

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

For your dynamic pivot, you can pre-fetch all #__fields titles, and create a pivot query on the fly in PHP. … Alternatively, there is nothing wrong with grabbing my very first (non-pivot) query, extracting all of the unique title values from the verbose result set, then iterating your result set to manually group …
mickmackusa's user avatar
  • 4,846
2 votes
Accepted

PlotALOT RSForm Query showing only one result

From this sample data: INSERT INTO `o2pe0_rsform_submission_values` (`SubmissionValueId`, `FormId`, `SubmissionId`, `FieldName`, `FieldValue`) VALUES (2124732, 23, 47529, 'SHELTER', 'Bellville'), (212 …
mickmackusa's user avatar
  • 4,846
1 vote
Accepted

Joomla mysql query - group_contact

I really can't see the use in retrieving the SubmissionValueIds or FormIds associated with the rows of data after you pivot into an associative structure. … If you already know all of the FieldName values that you are going to processing, you can most simply use a pivot technique -- here are MANY demonstrations that I've posted. …
mickmackusa's user avatar
  • 4,846
1 vote
Accepted

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

This will rely heavily on the magic of a "pivot" technique. Here are some more examples in JSE to compare/contrast with https://joomla.stackexchange.com/questions/tagged/pivot. … If you need more examples, I have a few Stack Overflow pivot answers too. 1, 2, 3, 4, 5, 6, 7, 8, 9, 10. …
mickmackusa's user avatar
  • 4,846
1 vote
Accepted

RSFORM combine 2 submission form results in one Plotalot view

I think the simplest way forward is to use a JOIN to relate your first query to your second query. An INNER JOIN (same as JOIN) will only generate rows in the result set where both "derived" queries …
mickmackusa's user avatar
  • 4,846
0 votes

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

This technique is commonly referred to as a PIVOT. You can find my other Joomla-related pivot queries on Joomla Stack Exchange. … I will show a classic pivot query with an INNER JOIN and another query that uses a subquery with EXIST to isolate the unique counts. …
mickmackusa's user avatar
  • 4,846
1 vote

How to re-write sql for joomla JDatabase

If you are new, then I'd like to include some basic error checking as well as printing out the generated query and the 2-column resultset. Untested Code: $db = JFactory::getDBO(); try { $query …
mickmackusa's user avatar
  • 4,846
2 votes

How to retrieve RSForm submission data grouped by SubmissionId?

What is best suited is a "pivot" technique. There is no cleaner way to deal with rsform's submission data. …
mickmackusa's user avatar
  • 4,846
1 vote

How to refactor two select queries on RSForm submission data?

The cleanest, most direct way to perform this task is with a "pivot" technique. … $e->getMessage(), 'error'); // never show getMessage() to public } If you would like to see this technique in other contexts, here are some other pivot solutions that I have posted: https://joomla.stackexchange.com …
mickmackusa's user avatar
  • 4,846
0 votes
Accepted

How to collect multi-row data from #__fields_values and assign specific aliases for each val...

Raw Pivot Query SELECT ju.username, ju.name, MAX(IF(jfv.field_id = 2, jfv.value, NULL)) AS `door`, MAX(IF(jfv.field_id = 3, jfv.value, NULL)) AS `staircase`, MAX(IF(jfv.field_id …
mickmackusa's user avatar
  • 4,846
1 vote

How to get Custom Fields related to Joomla Content?

called "genre" 2 relates to the custom field called "somethingelse" To use pure sql to extract a single article's custom values and assign meaningful column aliases you can use a technique called a pivot … Not using a pivot will mean your result set will have n rows with one value in each row. …
mickmackusa's user avatar
  • 4,846
1 vote
Accepted

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

Use a pivot technique instead of making multiple JOINs. This table is often gigantic and the fewer times you need to join the whole table in your sql, the better. …
mickmackusa's user avatar
  • 4,846
1 vote
Accepted

PieChart For RSForm for PlotaLot based on a dropdown field

Add a HAVING clause that pre-qualifies aggregrate data in your derived table. The following condition will require that a submission contains a Part No value of 5. HAVING COUNT(FieldName = 'Part No' …
mickmackusa's user avatar
  • 4,846
0 votes
Accepted

Create Plotalot chart from RSForm Pro data using pivot query

It looks like you found the pivot pages on JSE -- well done. Also, you coding attempt is very close -- you just need to create two-column rows for PlotALot. …
mickmackusa's user avatar
  • 4,846