I am trying to find the most frequent string ignoring everything after ( within it. So, how it should work. If I’ve got the strings: It should return because it’s the most frequent country here and no matter that as a string England (88) is going to pretend. Unfortunately, my query returns SQLfidd…
How to find these master records whose totals are not accurate
I have two tables (master-details relationship). The master table has a column (called total) recording the number of details records for the same master record. Having this column is for the performance reason). Here are the table specs: Because deletion of details records, the total in the master table may …
Inner join on multiple columns in SQL Server
I have two tables tbltask tbluser In tbluser I have two columns, userid and username Sample data: 1 ibrahim 2 nizam 3 shahrukh 4 saddam and in my second table, I have multiple …
Counting number of records with matching values in separate fields
database/SQL novice here. I have a table in DB MS SQL Server 2008 that looks like this: I want to find number of rows by values parameter1, parameter2, parameter3, number of request Result should be like this: How can I do it? Please help me. Answer
About set id=1 and password = ‘ ‘ in the SQL injection [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 5 years ago. Improve this question Here is certain expert’s code: https://github.com/DalerAsrorov/Security-Flaws-And-Thei…
Is there a way to execute an SQL merge atomically?
I am looking for a way to connect a tuple of values with a random UUID in a non-locking manner and without the potential to fail a transaction due to concurrency constraints. The table I need to …
Replace chars in string if it starts or ends with specified char
I have a column in my database with entries that starts or ends with a hyphen. I would like to find these rows and remove/replace the hyphens if it’s the last or first (or both) char in the string. …
Teradata locks table for read while accessing to table through view with access rights
This is really weird. I have 2 view, one with access rights and other with read rights to table. replace view v1_read as locking row for read select id1 from t1; replace view v2_access as locking …
sql query to fetch exchange rate
Given a sales table with sales amount stored in local currencies and an exchange rate table containing currency conversion rate, to get total sales amount in USD for each sales date I need query Sales Table: Exchange Rate Table: have no idea how I should proceed I have to do two things match the currency and …
Max Value based on two columns
I have a table with multiple columns that contains both month and year. I’m trying to identify based on column1,column2 what is the greatest month and year. I have a DDL for a test table as such. This is the data in the example table. I want to get the record with the max month and year. When I attempt