created_at iteration group_hits_per_iteration ——————————————————————– 2019-11-08 08:14:05.170492 300 34 2019-…
Tag: sql
Joining INTO many-to-many table (From Primary Key Table)
This is how far i have gotten, though i don’t think it can be done with 1 SQL-statement, i just want to confirm whether or not it is possible to do this with ONLY 1 statement: SELECT * FROM users …
How to not return result if one value is null?
There is a top level weight for a shipment but within that there is several weights for handling units. If one of these handling units has no value then I want the shipment to not show up in my query….
LEFT JOIN not showing days with zero COUNT
I am trying to retrieve data from the last X days, counting the new rows per day. I need to get also the days that have COUNT = 0. My query right now is: SELECT COUNT(*), CAST(TIMESTAMP_T AS DATE) …
MySQL Workbench: “SELECT” is not valid at this position for this server version, expecting : ‘(‘, WITH error
I have the following SQL query which I have written in MySQL Workbench: SELECT t1.sample_id, t1.v_id, t1.s_type as type, t1.s_fusion, t1.e_fusion, CONCAT(t1.cpt1, “:”, t1.ppt1) as point1, …
Salesforce Marketing Cloud SQL PIVOT
I’m trying to create a pivot in SFMC to combine multiple rows into one column. The query is running successfully, but not populating correctly. My table has 2 columns: email address and product_sku. …
I am trying to create a table in SQL and keep getting an error
I’m using Teradata SQL assistant to create a table. The code I am using is as follows: CREATE TABLE calendar ( CalendarKey INT NOT NULL, FullDate DATE NOT NULL, DayOfWeek VARCHAR(20) …
Adding a column to pull in name of the table in union query
I have 2 queries that I want to combine before exporting to Excel. I used a UNION query to do so, which worked great. Now I want to create a column that says the name of the table it came from. What …
SQL summing the same column with different date conditions
I’m using one table and am trying to sum total spend for two separate years, pulling from the same column. Essentially I have a list of customers, and I’m trying to sum their 2018 spend, and their …
Rank Values by Partition in SQL
I am trying to create a new column that counts unique partitions of another column. ColA *NewCol ———— A 1 A 1 A 1 B 2 B 2 C 3 C 3 C 3 I have tried using …