Asked for the logic yesterday, now I’ve worked a way around. I have a big table used for reporting (170k~ rows) and many of them are “duplicated” but with updated dates (e.g. old record says John Doe …
Tag: sql
Use time selector from Power BI as an argument in my SQL query
I have a simple query like : SELECT COUNT(DISTINCT(p.id_organization)) AS Count FROM dbo.paiement p WHERE p.statut = ‘AUTHORIZED’ AND p.[date] > ‘2018-01-30’ I try to show this data on a …
Count as duplicates similar values
I have following tables: Orders order_id 9 10 11 Order_details order_id, product_id 9, 7 10, 5 10, 6 11, 6 11, …
how to compute percentage in mysql/sql when 2 group by conditions are present
id title count organizer 1 music 4 2 2 sports 6 2 3 music 2 3 I have a derived table with the above structure. I need to compute the percentage of the number of events of each …
how to fetch data from two tables in JPA
I am not able to fetch all records from two tables using the below query I have tried this but I am getting a result from one table only. I want a result of both the tables i.e, …
Getting the Top 5 rows by score for each group
I’m trying to get the top 5 comments by score for each Reddit post. I only want to retrieve the top N comments by score for each post title. Example: I only would want comment 1 and 2 for each post. …
Identify rows with particular value across multiple columns
Each row has an Id and a Category Presence/Status combo. Sample code: DECLARE @sample_table TABLE ( Id INT ,Category_Alpha BIT ,Category_Beta BIT ,Category_Charlie BIT ,…
Find most recent row per user and day in sql query
I want to find the most recent purchase per customer for each date (a customer might make multiple purchases on a given date and I want the most recent for that date). My dataframe looks something …
Track customer loss in redshift
I have a data base that looks like this. It has: acct_open_dt, or the day the account was opened. acct_close_dt, or the day the account was closed. dayssinceopendt, which is TODAY – acct_open_dt if …
Casting the Bigint number Returns NULL
I need o convert a integer value to the highest data type in hive as my value is of 25 digits NULL value will be returned for the above select stmnt; I am very well aware that the supplied number is greater than the largest number of Bigint. But we are getting such values upon which i have to calculate