Skip to content

Issues with GROUP BY and NULL (SQL / BigQuery)

I have some bad data that I need to transform a bit and am struggling to do. Below is example data and desired output. What I’m hoping for is if PUNCHIN is NULL, but there is another value of PUNCHIN for that EmployeeNum and APPLY_DATE, then use the other value. Otherwise, use SHIFTSTARTTIME. And the sa…

Counting and Joining in SQL (oracle)

My database contains 2 tables called products and product_categories. Product_categories contain category_id and category_name Products contain category_id and other irrelevant info for this question. …

Pivot table in alphabetical order

Am new to MySQL, I want to pivot a table Table contains two columns only Name and Occupation Where no null values are inserted I want to pivot the occupation column so that each Name is sorted …