I’m working with a really old database and I’d like to do a simple join. Unfortunately, there is no intermediate table and it’s not possible to implement it in the near future (I know it’s really bad). The tables look like this: Expected result (for tbl_1.id = 1) How can I achieve that? I tried (didn’t work): This works but
Tag: mysql
Compare rows in one table with MySQL
I tried to compare rows in one table that I have. The table is like this: table I have 3 rows for comparing, and they had tp 1,2,3 for each one with the same fid and different id. The question is, how can I compare three of them to return? For example, more explanation For example, if ct of the
How can I pass multiple parameters to identify a page?
I currently have one question and that is if I can pass 2 parameters in my url to identify a page. Currently I have this code, which gets me through the parameter “url_slug” my post stored …
SQL: How to check if group of rows already exist in a table
I have a simple chat functionality in my application where signed up users are able to create chat groups with other users. To store the information which user is a member in which chat I am using a …
Aggregating data percentage wise based on date related criteria from a table
I have legacy tables which tracks flight and had to extract data. We have three tables named booking, airlines and flighttype. Note this is a dummy samples booking : id customer request_date airline …
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 data. Now I’m
MySQL automatic apostrophes any ideas?
Im trying to patch a value in my Database, but Im getting an error. Backend: Frontend: Error: “You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ”important’ = 1 WHERE todo_id = 1′ at line 1″ SQL after processed: sql: “UPDATE posts SET ‘important’
SQL: Why do I not get the same output with the two queries below?
I am trying to find Students who got all possible different grades. If you receive an 18 you pass the course and the highest number is 30. Thus, if you have received 13 different grades which are higher than 17 you have in turn received all possible passing grades. The first query returns 0 rows and the second one returns
How to combine two queries? MySQL
How can i combine my two queries? 1: This query is finding dialogs where more than 10 messages and lasted more than an hour. 2: The second query selects two last rows for each dialogs. So, what i want is select last two rows for each dialogs that lasted more than an hour and where more than 10 messages. I
MySQL how to search a JSON field for all rows that intersect with JSON values
Assume that I have a MySQL table with a JSON field, with the structure & values shown below: I would like to get all rows that have ANY of the JSON values that match in a SELECT query. For example: This yields 2 rows: However, I would like it to yield all of the rows, because every row has at