I have sql select name, tanggal, status from tbl_person where status = ‘PROSES’ and date_part(‘year’, tanggal) = 2021 – INTERVAL ‘1 YEAR’ tanggal is date 2021-01-01 I want to …
Tag: sql
Javascript won’t work properly with my form
So I am currently doing a project for our class, in which I have to display something that I previously stored in a database on a separate page. I chose to display every dataset, as it is the easiest to do. With PHP I implemented a foreach loop which is supposed to show each dataset with a button “EDIT&…
SQL Statment fails to run with Syntax errors using Flutter/Dart and PostgreSql 12, even though exact same query runs to the same db from python
Hi Flutter/Dart/PostgreSQL noob here; I have an SQL statement which is running fine from a python/Flask application, I am using some variables within it which are added in at runtime to the statement before it is sent to the db.This is the python version; As I said this works fine apologises if I have not add…
Calculate share of value per day per country
DB-Fiddle Expected Result: I want to calculate the sales share per country per day as it is done in the question here. However, since I added the column channel in the database I am not getting the right shares anymore using this query: How do I need to modify this query to get the expected results? Answer he…
Column name is ambiguous on UPSERT action
I am trying to run an UPSERT query string on a postgres db – insert into business_data_test (select * from business_data_tmp) on conflict(phone_number) do update set average_expense=(…
What does the “i” stand for in this SQL query?
I’m looking at a bunch of SQL query’s made by another individual and am trying to interpret how they were made. I’m fairly new to SQL so its involved a lot of Googling, its also my first time posting …
SQL query filter down to only applicable rows
How would I select a query like this? I am a bit confused because this would return nothing since any of the rows do not fulfill any of the “where clauses”.. What I would like is the answer …
similar to groupByKey() in Spark but using SQL queries
I trying to make into using only SQL queries. It is kind of similar to using groupByKey() in pyspark. Is there a way to do this? Answer Just use conditional aggregation. One method is: In Postgres, this would be phrased using the standard filter clause:
How to create procedure in mysql
I am creating a procedure in mysql but I am facing issues with the required result and now I am in a total mess. Please help me! The requirements is this: Get the Top 20 entries from the table, for the current day. By Top 20 entries, they should be the ones that occurred most often during the day –
Conditional Aggregation with multiple case and group by
The query below gives me average of case when QuoteStatusID = 6 but it I am having issues with associating the average by Street column. QuoteTable QuoteID QuoteStateID ProjectManager_userID Shipping_AddressID 1 6 12 56 2 6 12 56 3 26 12 56 4 6 12 18 5 26 12 18 Shipping_AddressID 56: 338 Elizabeth St 18: 83 E…