Skip to content

Tag: sql

Hive – Query to get Saturday as week start date for a given date

I have an requirement in hive to calculate Saturday as week start date for a given date in hive sql. Eg) I tried using pmod and other date functions but not getting desired output. Any insight is much appreciated. Answer Hive offers next_day(), which can be adapted for this purpose. I think the logic you want…

Update all rows with different values. When where conditions differ

Apologies in advance for the confusing title, but couldn’t quite find the right way to summarize it in the title. I have a table in SQLite Studio with four columns ID, Name, Tm (which means team) and TmID (TeamID) and 326 rows Obviously the query above allows me to update each row where the team is &#82…

SQL get total sellers of product category

I have like this database tables: Table categories Table products Table product_varieties I have query to get price min, max and avg in each category: Now I need get total users (sellers) of each category by editing my current query. I tried like this: But my query not work and return error with message: How …

How to select data where more than one column is populated

I have a sample table, called [SAMPLES] which I’ve added multiple columns to the end for different types of lab analysis results, however for the majority of samples only one analysis has been completed. I want to be able select only the samples where more than one analysis has been completed on the sam…