This is probably a pretty simple question, but I have two separate queries that I would like to join into one table. One of the queries shows sign ups to my website by month and the other query shows sign ups that have made a purchase. I would like to combine the two queries into one table so I have
How to de-duplicate SQL table rows by multiple columns with hierarchy?
I have a table with multiple records for each patient. My end goal is a table that is 1-to-1 between Patient_id and Value. I would like to de-duplicate (in respect to patient_id) my rows based on “a hierarchical series of aggregate functions” (if someone has a better way to phrase this, I’d …
How to get “session duration” group by “operating system” in Firebase Bigquery SQL?
I try to get the “average session duration” group by “operating system” (device.operating_system) and “date” (event_date). In the firebase blog, they give us this query to get the average duration session This query give me the total user engagement by user ID (each row is …
Oracle UNION depending an IF conditon
I have to make a SQL query wraping all of theses statements: First, I have a first SQL query like this: Then, I have another SQL statement like this: Finally, based on the first SQL statement, I have to add a row of fake data on the result of the second statement if NbOfEntries > 0. I have to add
Add child note above node
Am trying to get from SQL to XML however have to format this correctly or it will not work. I am using C# to insert my sql between the QBXML This is what I get This is what I need ”’ ”’ I am not sure how to add the “CustomerAddRq” over each “CustomerAdd” Answer …
SQL select the latest record on joined tables
I want to retrieve the property which an user paid a tax last. have two tables person_properties and property_taxes What I tried so far: This gives me the person_id along the max year. But I actually need the property_id, the property which an user paid last. If I replace pp.person_id by pp.property_id, I the…
Remove multiple instances of the same person, different IDs from SQL Server
I have a data set where there are individuals appearning multiple times with the same name and SSN but different personids. I want to remove those people and only keep those that appear one time. In this instance I only want to return Roman Smith and eliminate John Thomas altogether. I’ve been playing a…
How to count two different columns in sql
I have a database which looks like this. My task is to get the columns of dates, number of exams on that date, number of students who write an exam on that date. Something like Date – Exam Count – Student Count. I have done this but in two different queries. Result: edate Exams | =================…
Create SQL command with a query parameter that checks for NULL but also for other values
I am trying to write a dynamic SQL command using Python / Postgres. In my where clause I want to use a query parameter (which is user defined) that has to look for NULL values within a code column (varchar), but in other cases also for specific numbers. If I have to check for a certain value I use this:
FOR XML in SQL Server: Elements based on common values of columns
I’m using FOR XML to create an XML file out of SQL queries. I want to have elements based around common values for a particular column, in this case “location”: I can easily convert his into XML row-by-row like so: Which produces XML that looks liks this: But what I actually want is this: An…