How to find only matching nodes (specific information) in one to many relation record in MongoDB - mongodb-query

How to show only the highlighted record in MongoDB. When I set the filter as shown in the image to show only ENAME = 'MARCO', it shows all nodes as E1,E2,E3,E4,E5.
Hope somebody can answer my query. Thank you!

After some R&D found this answer:
db.Multisql.aggregate([{$unwind: "$Customers"}, {$match: {"Customers.FIRST_NAME": "TEST"}}])

Related

How to count a phrase in Big Query view

I have fir-ui-af***:firestore_export dataset in my BigQuery project.
In this dataset, I have speech_raw_changelog table and speech_raw_latest view.
This is schema of speech_raw_latest view.
In data field which I marked with a red pen, there is JSON data.
This is an example of field and value in data.
I would like to count the number of ******ka#gmail.com in email field in this speech_raw_latest view.
I searched the Internet and found that I should use COUNT function, but I don't know how to use it to solve my problem.
Could you give me any advice, please?
Below is for BigQuery Standard SQL
SELECT COUNTIF(JSON_EXTRACT_SCALAR(data, '$.email') = 'ka#gmail')
FROM `project.dataset.speech_raw_latest`

dBeaver doesn't show me all the results from a Vertica table

I am trying to get a list of users, who submitted a specific event in a website, however when I run the query, I am not getting the full result set - for example, I found 2 users who had the event (and I used the same conditions), but are not in the result set.
The script looks like:
select userid
, Date
from c
where year(c.Date) = 2018
and week(c.Date) = (week(getdate()) - 1)
and Event in ('existing', 'submit_existing', 'submit_new')
group by 1,2
Can anybody give me a hint what might be the issue?
If anything is unclear or if you have any questions, let me know!
Thanks!
https://github.com/dbeaver/dbeaver/issues/1708
Ctrl+Alt+Shift+A or right click menu: Execute => Select all rows.
so I managed to find the answer!
The reason for my problem is that in dbeaver there is a Maximum result-set size filed and if you have a lower number than the result set you are expecting - you will get duplicates and missing data, because each time it runs it shows a new results set.
Hope this can help somebody!

SQL: Get tupels of records with same many to many relationship

I got another SQL-Challenge.
I have the following relations (I removed all unimportant attributes):
passenger(id)
flight(id)
passenger_flight (passenger_id,flight_id)
Now I want to get tupels of all flight_id's having exactly the same passenger list.
Hope you can help me.
John

TDBGrid where is the SQL WHERE condition?

I am working on an already started Delphi project where there is a TDBGrid. The grid seems to be filled by a TADOTable that refer to a Bill table in the dataset.
It display a bill by PkBill. I can't seem to find where in the design or in code someone told to load only for this pk.
I need to load multiples Pk at the same time. I'm used to create programmatically a TADOQuery, create a connection, write my SQL code, then do what I want with the result. With those objects/controls, I just don't know where to do that.
Thanks for the help and clarity!
Check TADOTable.MasterSource to see if it's in the Master-Detail relationship.
Or you could check TADOTable.Filtered and TADOTable.Filter to see if it's being filtered by PkBill.

SQL Server How to Build Query?

I'm kind new in this forum but I'm stuck in a problem and I need our help.
I Have one table with several lines where each line represent one project, then in another table I'll have many tasks that need to be done in each project, each task would have a percentage of at what level is, and the result of this two tables is one table where I'll have the process Id and also the percentage of accomplished with the average of the last entries of every tasks values.
I can't figured out the query that needs to be done to have the result that I want.
Can anyone help me? You can see follow the link bellow to see tables and the result that I want.
Table iamges
I didnt understand the colors of rows you used, but with your description, i think this is the query you are looking for:
select P.id_Proceso, P.SubProceso, avg(R.estado)
from Processos P
join Registros R
on P.ID = R.Id_processo
group by P.id_Proceso, P.SubProceso