I would like delete some observations in some groups based on a condition. My condition is each group : if (imput=”toto”) then delete but if a whole group has imput=”toto” then …
Category: Questions
SparkSQLContext dataframe Select query based on column array
This is my dataframe: I want to select all books where the author is Udo Haiber. but of course it didn’t work because authors is array. Answer You can use array_contains to check if the author is inside the array: Use single quotes to quote the author name because you’re using double quotes for the query string.
SQL – combine rows conditionally on the value of previous row
My issue I believe is best explained by using an example: Sample Data SO Customer Product Description Quantity Extension Country 01 xxx 123 Product A 01 20.00 USA 02 yyy 456 Product B 02 25.00 China 02 yyy 456 Product B 01 12.50 China 02 yyy 789 Product C 01 50.00 Mexico 03 zzz 789 Product C 01 50.00 Mexico
Adding all values from output SQL
So, i have a query which looks like this: And it gives me back: Is there any way that this query will give me back added value? Just number 860. Kindly please help me :/ Answer You can just sum all the points you got from your query:
excel ace.oledb vba connection to csv returning only first column
In VBA Excel (Office 365) trhough using a connection string like “Provider=Microsoft.ACE.OLEDB.12.0;data source=…” and using the command string SELECT * FROM [text;HDR=Yes;FMT=Delimited;…
How can I get the percentage of time per user in sql?
I am making an app where people can select a song and listen to it. Whenever someone plays a song it should display the percentage of the how much youve listened in an overview. I have the following …
Calculate order sequence in BigQuery
I am new to BigQuery SQL and struggling with calculating an “order sequence” from a table of customer orders. In my example, I am working with customer purchases, where I have the sales …
sql oracle – select availability between dates
I have the below table INDISPONIBILITY, that respresents the availability of teachers, for example the teacher a1 is not available from 25-Jan-21 to 25-Jan-21 from 8:00 to 12:00. I want to select …
Convert PostgreSQL COUNT … FILTER query to SQL Alchemy
I’m new to SQLAlchemy, and I would like to convert this PostgreSQL query: I have already tried this: Thank you in advance for your help Answer Thanks to @IljaEverilä’s comment, here is a more direct answer: (Original answer) I’m not sure if SQLAlchemy’s postgresql dialect specifically handles COUNT … FILTER, but you can accomplish the same thing using SUM and
Loop through one table’s debit amount to find another tables matching credit amount
I have a table of accounts receivable transactions where I need to allocate payments to invoices automatically. I am battling to come up with a SQL script that will match the debits in one column to …