need your help. I guess/hope there is a function for that. I found “CONNECT DBY” and “WITH RECURSIVE AS …” but it doesn’t seem to solve my problem. GIVEN TABLES: Table A +——+-…
Find sum of engagement_time_msec for users who have done an event named “yt_event” in BigQuery
My table looks like this: There’s one more column named “user_pseudo_id” which is unique id for users. I want to take sum of event_params.key = ‘engagement_time_msec’ for user_pseudo_id who have done event_name = ‘yt_event’. Also, event_params.key = ‘engagement_…
SQL – select where for specific id, all distinct values for other column exist
I am having a bit of a hard time explaining the logic I want to achieve in the title. Anyway, I have a database containing two tables (rent and car). The car table contains data about cars (license …
How to average/aggregate the result off a SQL query?
I have a table with many rows each belonging to different users. I first want to select all rows the belong to one user and then on each row add the average for that a certain column but can’t make it work. I’m would like the result to display the average on each row for the user but it’s cu…
MySql : how to join this two tables with multiple pivot
I want to get the last activity of my client but i dont know how to that that with two tables that have more than one pivot. Please look at to the example below : I want this result (last activity is the lastest date of (check_mo and check_pa). and relationship between tables is (account.id => product.chec…
PostgreSQL, summing multiple date columns over multiple rows
Let’s assume the following table: CREATE TABLE assumption ( datetime_1 TIMESTAMP, datetime_2 TIMESTAMP, datetime_3 TIMESTAMP); Now I want to know the total amount of times a month is set in any row …
SQL: read text inside the span HTML element returned by a query
I have one query that returns the following HTML element: My query currently looks something like this: How shall I change this query to return only the text inside the span element shown above? In the example above the result should be the string: I am not sure how to extract this text using SQL.. DBMS imple…
Primary key constraint gets removed when creating postgres table from pandas dataframe
I am trying to create few tables in Postgres from pandas dataframe but I am kept getting this error. psycopg2.errors.InvalidForeignKey: there is no unique constraint matching given keys for …
Postgres: Mathematical functions in COALESCE
I have a table which contains ID column: ID — 1 2 3 4 5 I have to retrieve an ID using a simple query. If the ID is not present in the table, then I want to display ID – 1 For example, In the above …
Get WooCommerce single products data from database with a SQL query
I am trying to get the raw data from the database for the woocommerce_single_product_summary in woocommerce. I need to use the data externally, but I cannot figure out how this is placed in the database, I can gather everything else I need with: Answer To get the correct desired meta keys from wp_postmeta tab…