I have 3 tables: products (id, category, …), store_offers (product_id, offer_id, platform) – joining the products table with many tables with offers, e.g. ebay, amazon, etc. ebay_offers (id, status, country, …). I need to get the id of products (in addition with a specific category_id) that …
Tag: sql
Aggregate data based on unix time stamp crate database
I’m very new to SQL and time series database. I’m using crate database ( it think which is used PostgreSQL).i want to aggregate the data by hour,day ,week and month. Unix time stamp is used to store the data. following is my sample database. i tried the sql query using FROM_UNIXTIME not supported …
Passing date variable in Power Query to ODBC source
I have managed to extract a date from Excel (that the user can amend).[A named range called DateB]. I want to be able to pass that to a variable in the sql part of Power Query so that various checks can be made before passing the data back. However, I cannot get the variable @man_Date to accept the date that
SQL SELF JOIN return null if not exist
Recently, I got a table A like this: I try to SELF JOIN this table by I got this What I expect is when VoucherID doesn’t have any reciprocal account, that record will return null, like this Is there any elegant approach? Thanks all. Answer Why not just use aggregation? You could also do this using left …
Display each sql db row in a single php page
I’m trying to display each single row from my db as a separated unique page, so when I click on the row link (which I don’t even know what it is until now) it directs me to a new page with the content of this row or some of the content as I desire.. So I created a new php
filter timestamp column in SQL Oracle
I have a table with a Timestamp column which I need to filter after ‘2020-08-26’, but every solution won’t work RUN_TIME 2020-07-22 04:22:07 2020-07-22 04:34:07 2020-07-22 04:45:07 2020-07-22 04:50:07 …
How to speed up sql query execution?
The task is to execute the sql query: select * from x where user in (select user from x where id = ‘1’) The subquery contains about 1000 id so it takes a long time. Maybe this question was already …
Wrong syntax for OVER and PARTITION in MySQL syntax
SELECT Id, Price, CustomerId, ROW_NUMBER() OVER (PARTITION BY CustomerId) FROM Orders; I get the error “Syntax error: Unexpected ‘(‘ (opening parenthesis) Does MySQL not support this? I’m pretty …
How to get the third level of a tree in SQL
I aim to list the forth generation of a family using SQL Server. Example family tree in the picture (id based) FAMILY TREE The tables I have are: Family +——+—————–+ | f_id | f_name …
Postgres SUM over given time
I am trying to SUM google analytics data over a given time using Postgres. I am not quite sure how to get around a grouping issue. The query you see below returns one column per day. I want to SUM all …