I am generating an SQL query and I need to get the data from a JSON stored on a field of my table. It goes something like this So basically I am trying to get put a connection with tables creation and lookup_detail through field FACILITY_DATA which has JSON data and alias of loanType to reference against DETA…
Tag: join
MySQL – JOIN with table on partial string match
Trying to LEFT JOIN a table with partial string match. I’ve tried changing the wildcard in the LIKE condition, but it still only searches for the full string. Any suggestions? I’ve got a list of product abbreviations stored in a table. Would be easier to manage this list with partial matching vers…
Syntax for counting greater than and summing a value with multiple joins without the keyword having
I’m learning SQL (Postgres) and I’m slightly confused about something I’m trying to do. I have the following tables. Employee: Project: Department: And works_on: For this, I was trying to do something slightly more complex: To create a view that has project name, department name, number of e…
Order of tables in INNER JOIN
Going through a book, Learning SQL by Alan Beaulieu. On topic of inner joins, it tells that whatever be the order of tables in a INNER JOIN, results are same and gives reason as follows: If you are confused about why all three versions of the account/employee/customer query yield the same results, keep in min…
mysql: Select all rows and compare with other table
I have two tables and need to get all rows from the first one and then check which values from the second table match the first table. My goal is to get all so called ‘achievements’ and then check which one the user has reached. achievements achievement_user My desired result for a query where I c…
How can I join a table to itself to get the values needed?
So I have a table that I’m trying to join to and I’m not quite getting everything I need. So I have a table that looks like this. I want to see if there is a way to join this table to itself to get the rest, so I see that when I see the code ‘0013’ then I should
How to fetch value from JSON document inside MySQL column?
I have written following MySQL Json Array query. The Mysql version is 8.0.18-commercial select r.network, s.server from table1 e inner join table2 s on e.objectId = s.envId inner …
Reducing granularity of historical status table?
I have a table with what are essentially historical logs for project tasks. Each row contains the ID for a project and the date of when one specific task was either started or ended. I need to reduce the grain so that all of the start/end times are in a single row (see IDs 1 and 2 in the image)
Joining on 3 csv files
I need to retrieve data from 3 different CSV files (Adres.CSV, ID.CSV and Regios.CSV) and combine this in an Excel table. This SQL statement works fine, StrSQL = “SELECT ID.[ID], Adres.[Naam], …
SQL COUNT with condition and without – using JOIN
My goal is something like following table: With two simple selects I could gain this values: (the key of the table consists of 3 columns [t$ncmp, t$trav, t$seqn]) How can I join these statements? What I tried: I tried different variantes, but always got errors like ‘group by is missing’ or ‘…