Skip to content
Advertisement

Tag: join

Subquery to get derived value

I have the below table T in MySQL, with columns A and B. I want to query this table to get a value ‘C’, that has the count of the number of times the value in Column ‘A’ appears in Column ‘B’. For example, 1 appears 2 times in Column B, so the first row of column C should be

Arranging VARCHAR data into Columns in SQL

My data is in a SQL table in the following format (I have about 20 different answers per user_id): I would like to create a view in PostgreSQL where all the data is shown according to User ID Thank you! Answer It is great example of not relational data (the semantic depends on row number), although the data are saved

SQL combining tables to single rows

A problem with combining tables into single rows. TABLE GAMES: ID player1_ID player2_ID des 11 23 68 something 82 34 23 whatever 302 13 34 mmmmmmmm TABLE PLAYERS: ID alias 23 Jeex 34 Jack 68 Jill 13 John The key I start my query with is one of the Player ID’s. I want to show all the games that Player

Aggregated row count differences between tables

I have two MySQL tables A and B both with this schema ID entity_id asset asset_type 0 12345 x 1 .. ……… ….. ………. I would like to get an aggregated top 10/50/whatever entity_ids with the largest row count difference between the two tables. I think I could do this manually by just getting the highest row count by entity_id

update join with where

I need to update a certain alert on a loan where the obligor and obligation is something, but I can’t figure out what I’m doing wrong in the join. This seems to update all alerts in the table rather than the specific one I want. We are using postgresql db Answer Workbench usually refers to MySQL. If so, then the

cte FULL OUTER JOIN MYSQL

I have this table(called trial): ‘year1’ refers to values in Column ‘val1’, ‘year2’ to values in Column ‘val2’. I want to get totals of all values grouped by year. So I would like to see a result like: I set up a common table expression(cte) using a self join to do this as follows: (The first four output columns are

Advertisement