I have a table – ‘clicks_plus_noClicks_raw’ like below If customer has not clicked on any of the last 3 emails we sent(exact 3), I want to add the result to final table with count as 0. a@gmail.com & b@gmail.com should be skipped because we dint send them 3 emails yet.The final results s…
How to select two last year in more actual year
I would like to know how we can select the two last year in more the current year. For example, If I have a table like it : Then I want it : I tried to use dateadd like it : But I just got the 2 last year since now, I would like to got 2019, 2020 and 2021
How to update several tables with a result query?
I am working with SQL Server 2017, and I need to clean up duplicate rows and update all rows in other tables that contain my field. I’ve got one table which contains my customers Then I have 7 tables that contains the userid column and 1 table with another name column My other tables: I want to clean th…
DELETE By Procedure With String Input – Oracle
I am writing a procedure to delete some records of z_names table by IDs from the input as string (and I need to seprate them by special character (comma ,)). Sample Input: ‘1,4’ z_names table: ID NAME 1 jim 2 john 3 jack 4 alex After running this procedure, the record with ID 1 and 4 (jim and alex…
how can i loop insert query?
I have a problem like this: I need to optimize the application, with db (postgreSQL), the table looks like this: I have more than a thousand such voters, and I need to put all of them in the database, but among them there are several duplicates that could vote several times (from 2 to infinity), and I need to…
Procedure For Get String And insert , In Oracle [closed]
I Have Two Tables first : CREATE TABLE z_names (ID number, NAME VARCHAR2(200)) Second: CREATE TABLE Z_FNAME (“FAMILY” VARCHAR2(200 BYTE), “ID” …
Get most recent record from Right table with sub query
When I join to the right table I am getting way too many duplicates. I am trying to grab the most recent record from the right table however, it does not matter what I try it does not work. So Far I …
SQL SELECT two specific names from table not working
Name UID Late Tin ABC 0 Bob ABC 0 SELECT * FROM `logs` WHERE Name=’Tin’ AND Name=’Feryal’ This query returns nothing for me and only works when I want one name. I could use the SELECT * but for …
Importing JSON data to SQL Server
Sample data looks like this: { “_id”: { “$oid”: “5ff1e194b6a9d73a3a9f1052” }, “active”: true, “createdDate”: { “$date”: …
What is the best way to implement a many-to-many relationship in PostgreSQL?
I’m trying to implement a many-to-many relationship in PostgreSQL. Here are the tables from my database: CREATE TABLE products ( product_id serial PRIMARY KEY , product_name varchar NOT NULL ); …