How to select all group with mat-optgroup? - angular-material

I wonder how can i select groups with mat-optgroup, i didn't find that feature in material api....
EXAMPLE

Related

Joining tables from multiple Projects within Big Query

So my requirement is to query data from multiple tables that reside across multiple Projects.
For e.g., I want to select few columns from project1.dataset1.tableA, project1.dataset1.tableB,
project1.dataset1.tableC and then select few columns from project2.datasetX.tableX.
Can I just do the below and would that give me the requisite information
SELECT
count(*)
FROM project1.dataset1.tableA vt
, project1.dataset1.tableB v
, project1.dataset1.tableC tp
, project2.datasetX.tableX si
WHERE vt.column1 = v.column1
AND v.column2 = tp.column2
AND vt.column3 = si.column3
tried the above, did get the result but wanted to cross check if thats the correct way to do it

Using a subquery as a parameter

I am using Google Sheets and have a connected query where I am using parameters. When one of the parameters is configured to be a subquery, the query will run, but no results are returned.
For example, here is my (simplified) query:
SELECT *
FROM table
WHERE campaign IN (#CAMPAIGN);
In this example, I have the #CAMPAIGN parameter in the Google Sheet configured as:
SELECT DISTINCT campaign FROM table2
If I manually substitute the parameter in the BQ console, it runs fine and returns the expected results. Is there a reason this functionality does not work with parameter substitution in the Google Sheet? Is there a way around this?
Depending on how much SQL SELECT type lookups you do, it may help to use a #customfunction that I wrote. You need to place my SQL .js in your Google sheets project and the =gsSQL() custom function will be available.
The one requirement for this versus using =QUERY() is that unique column titles are required for each column.
It is available on github:
gsSQL github project
This example works if each sheet is a table, so it would be entered something like
=gsSQL("SELECT books.id, books.title, books.author_id
FROM books
WHERE books.author_id IN (SELECT id from authors)
ORDER BY books.title")
In this example, I have a sheet named 'books' and another sheet named 'authors'.
If you need to specify a named range or an A1 notation range as a table, this can also be done with a little more work...
=gsSQL("SELECT books.id, books.title, books.author_id
FROM books
WHERE books.author_id IN (SELECT id from authors)
ORDER BY books.title", {{'books', 'books!$A$1:$I', 60};
{'authors', 'authors!$A$1:$J30', 60}}, true)
In this example, the books and authors come from specific ranges, the data will be cached for 60 seconds and column titles are output.

Group Filters in BI Publisher

Can we have multiple group filters created in BI Publisher?
I want to have more than 1 group filter i.e for example SAL >5000 & DEPT_ID IN (10,20). Right now I'm able to add only 1 group filter. Will BI Publisher allow me to add multiple group filters??
Yes you can have multiple group filters.
Write your data model and when you are going to save it,add all the parameters you want to keep in Parameters tab.
See the screenshot below
In your case,you don't have any parameter,so this you want is only to write the sql query and in where clause to put the conditions.
i.e
where SAL >5000 and DEPT_ID IN (10,20)
Hope,this helps..

Trying to create one table from four

I'm stuck trying to create a query that pulls results from at least three different tables with many to many relationships.
I want to end up with a table that lists cases, the outcomes and complaints.
All cases may have none, one or multiple outcomes, same relationship applies to the complaints. I want to be able to have the case listed once, then subsequent columns to list all the outcomes and complaints related to that case.
I have tried GROUP_CONCAT to get the outcomes in one column instead of repeating the cases but when I use UNION to combine the outcomes and complaints one column header overwrites the other.
Any help appreciated and here's the link to the fiddle http://sqlfiddle.com/#!2/d111e/2/0
I suggest you START with this this query structure:
SELECT
c.caseID, c.caseTitle, c.caseSynopsis /* if more columns ... add to group by also */
, group_concat(co.concern)
, group_concat(re.resultText)
FROM caseSummaries AS c
LEFT JOIN JNCT_CONCERNS_CASESUMMARY AS JCC ON c.caseID = JCC.caseSummary_FK
LEFT JOIN CONCERNS AS co ON JCC.concerns_FK = co.concernsID
LEFT JOIN JNCT_RESULT_CASESUMMARY AS JRC ON c.caseID = JRC.caseSummary_FK
LEFT JOIN RESULTS AS re ON JRC.result_FK = re.result_ID
GROUP BY
c.caseID, c.caseTitle, c.caseSynopsis /* add more ... here also */
;
Treat the table caseSummaries as the most important and then everything else "hangs off" that.
Please note that although MySQL will allow it, you should place EVERY non-aggregating column that you include in the select clause into the group by clause also.
also see: http://sqlfiddle.com/#!2/2d1a79/7

Group by Hstore Key in PostgreSQL and ROR application

I'm working on a ROR application and i use Hstore with PostgreSQL data base and i'm asking if i can do group by an Hstore key on my table ??
I did this :
select state , count(*) from infractions group by details -> 'commune';`
but i get this error :
column "infractions.state" must appear in the GROUP BY clause or be used in an aggregate function
details is the Hstore column and her is an example of my details :
"adress"=>"", "commune"=>"14", "province"=>"6", "description"=>"Ce fichier est sous licence Creative Commons"
thanks
People run into this occasionally when they move from MySQL. MySQL allows columns to be omitted from the GROUP BY clause. PostgreSQL does not. Your actual issue is that you are missing the state column. You have two options. If you want to pull just one state you can put it in an aggregate like this:
select max(state) , count(*) from infractions group by details -> 'commune';
If you want to group by state too you can:
select state , count(*) from infractions group by state, details -> 'commune';

Resources