Skip to content

Tag: join

additional condition in a SQL query with min(Date)

I have the code presented below provided to me by one of the members but I do not understand how it acts: The code extracts the min of start from another table. I wanna add an aditional condition like: I cannot insert the condition without an error. Also, I need only to see min(pr.”AsigStart”) fro…

SQL query to get the output

I have two tables Table A and Table B as listed below. What is the SQL query to get the below output? Answer This looks like a cross join, to generate all possible combinations of rows between the two tables. Assuming a structure like tablea(col), tableb(col): If you want to concatenate the results in a singe…

PB / SQLite3 JOIN COMPARE TABLES

I have Two tables : T1 T2 In SQLITE3 I search for n1T2 and n2T2 names, the count of same values between i1T1 and i1T2 I var_dump for display, in wait best method Answer It looks like you want a join and aggregation:

SQL subquery with aggregate value

Sorry for the vague title, I’m a little lost here. I have two simple aggregate SQL queries, but I struggle to combine them in a functional way (likely through a subquery) in IBM DB2. Main goal is to run COUNT function in INVOICES table – but with the starting date based on a subquery MAX aggregate…

Sql join in two tables and return empty tab as Unavaliable

In a SQL join, table 1 contains person info with city and table 2 contains city matched to country such as:- Table #1 Table #2 I want to get the person ID, Name, Country so while joining the tables I want these items and if there is no country available for a city, I want “Unavailable” written in …