We have a SQL database table recording customer comments (ARCMM). I want to extract the most recent comment for each customer. Some customers do not have any comments (i.e. no entries in ARCMM). The most recent comment for a customer will have the most recent date (field DATEENTR) and, for that date, the high…
Query to deduplicate based on one columns
My data looks like this in Teradata How do I construct my sql query to pull the latest loaded data like so: Basically every field will match except the id and the load_number. So given that every field matches except those two fields, can I remove ‘duplicates’ by taking the row with the higher loa…
PB / SQLite3 JOIN COMPARE TABLES
I have Two tables : T1 T2 In SQLITE3 I search for n1T2 and n2T2 names, the count of same values between i1T1 and i1T2 I var_dump for display, in wait best method Answer It looks like you want a join and aggregation:
How order by case and order too?
i have a query for my next table This could be the sql query : but now i need order by case: example: when ‘Scholar’ then 1 desc its possible do that? my goal is order by id, and by case type example: the result will be: Answer Your question suggests that want a new direction within each group: Ho…
mySQL question on how to add more info to a column
Got this table containing info about customers, dates and their purchases values. Let’s say some of them bought something in November but nothing in December. Now, I am trying to have all the customers + all they spent and to use IFNULL() to the ones that have not bought anything in Dec. I am filtering …
Oracle Remove Duplicates and Update Rows in a Table with a Value from Another Table
In my associates table I have 4,978 people with at least 1 duplicate. asscssn | count(*) ——— ——– 123456789 8 987654321 5 234567890 5 Each duplicate for a person has …
Remove duplicate values by taking latest data load
I’m working with enterprise data that looks like this. The issue is that the company has bad data practices and changes/reuses IDs, but only updates the load_number field. How do I construct my sql query to pull the latest loaded data like so: Basically every field will match except the id and the load_…
Oracle SQL query times in one line
I apologize in advance for any formatting issues. Here is some sample data. Here is what I would like to produce: Here is what I get when I use a series of case when statements Any coding help is much appreciated. Answer That is what the PIVOT clause was created for:
Response like that `Error Code: 2068. LOAD DATA LOCAL INFILE file request rejected due to restrictions on access.’ When I load the data from CSV
When I run the code below in MySQL5.0, I will have a response like: Error Code: 2068. LOAD DATA LOCAL INFILE file request rejected due to restrictions on access. LOAD DATA LOCAL INFILE ‘C:Users…
Laravel binding parameter using insert() with convert() inside
I am having a hard time binding my SQL query and I only have a few braincells left. Basically, this code works but prone to SQL injection: return DB::connection(‘sqlsrv_rfo_user’) ->table(‘dbo….