I have to compare two columns and be able to extract only rows where there is not even a partial match between strings. For example, I have this table: Col1 Col2 John Smith John Smith ltd Pepper Row Whatever Pepper red Blue The only row I should be seeing after the filtration is the last one: Col1 Col2 red Bl…
Tag: sql
Converting PostgreSQL to MySQL
I am following a tutorial on how to find recurring transactions in a bank statement dataset. I have all the data needed, but I have issues getting the queries to work with MySQL. Any idea on how to convert this to MySQL? The error is: Update I adjusted the SQL query based on feedback, and providing example da…
Passing parameters from Python to SQL Server
I have code like this: I am getting this error: ‘The SQL contains 1 parameter markers, but 2 parameters were supplied’, ‘HY000’ Is there any way to pass this parameter? I don’t want to create a dynamic array by concatenation. Is there any way to name the parameter marker inside t…
How to get the sum of a column in SQL Server and display in a single query?
I have this table where I have three particular transactions: Billing, Penalty and Discount. I want to compute the billed amount ((Billing – Discount)+Penalty). This should be the output What I have tried so far: I managed to get the billed amount for each individual account: Answer I would use conditio…
SQLite – Combining Rows into New Columns
I am attempting to create a chatbot in Python 3.9 using my own text messages, but am having trouble formatting my data correctly. I have a table of text messages that looks like this: row_id Type Date Text 1 Incoming 2020-08-10 08:09:18 Hi 2 Outgoing 2020-08-10 08:11:04 Hello 3 Incoming 2020-08-10 08:11:12 Fo…
Selecting specified query from multiple select statement inside a single stored procedure
Good Day everyone! I’ve been searching everywhere on how to get a specified query using if-else statement inside a single stored procedure but still no luck on how to achieve those function. Here’s the T-Sql When exec command is called, it only return Command(s) completed successfully instead the …
how to create a select statement with 2 foreign keys in one table pointing to two different tables
i have 3 tables and one of the tables (itemtag) has two columns each a foreign key pointing to each of the other 2 tables (item and tag). I’m trying to find out how to create a single select statement against this table containing fk’s using values that correspond to one of the other tables. Table…
Combine two columns and perform a where operation on the result
I have two columns, one for ‘firstName’ and one for ‘lastName’. I’m trying to perform a where operation on the concatenation of those two columns to match for a full name. Here is what I’ve tried: This just returns a blank array. Example Data: firstName lastName Clayton Smi…
Count the amount of likes a user received on each post sql
I have two tables. Likes table which contains it’s like_id (PK), vole_id, user_id, and created_at timestamp. And another table called voles that contain vole_id (PK), and user_id, as well as a bunch …
pagination show an extra page
I am currently doing a paging system and I have an error that the “NEXT” button continues to work despite having reached the last page, when clicking this it takes me to an extra page …