Skip to content
Advertisement

Tag: join

Create a left join with raw string data

I have a list of e-mails in a text file and a Person table with an email column. I need to know which of the emails are in the table, and which are not. So I was thinking in creating a query and do some kind of left join in my raw e-mail data with the Person table. Now, I

elect data from related tables with duplicate columns

I have 3 tables. news rubrics parent_id is key for id parent in table rubrics. And “news_rubriks” How I can select news which apply to rubrics.id and rubrics.parent_id ? Answer If I understand correctly, you want to apply a filter to both the rubrik id and the parent. Say if you are searching for 1, then you want 1 in

SQL Nested Joins (Case Statement and Join)

Hive DBMS; Two tables — A and B Table A Table B Question –> Trying to execute a query where: Join table A with table B, first on prnt_id, if it’s “unknown”, then join on sub_id, if that is “unknown”, join on ac_nm Desired Output: Answer You must use LEFT joins of TableB to 3 copies of TableA and filter

How find row by exact much of joined rows with SQL?

I have two tables I want to find specific row from parent table with name A which have exact two related rows in child table with names a and b. In example table is only one row is suitable (with id = 1). Row with id = 2 is not suitable because name of parent is B. Row with id

Get a value from two tables

I am trying to get the value of the colum “name” from the clubs table. First table:(Clubs) id* name (what i need!!!) email password Second table:(club_posts) id club_id* zip_id kategory type stadt plz Controller: This is my query: The result is an array with ten values, but need only one. Answer Create a relation club in you ClubPost Model so

JOIN ON either of the two columns but not both

I have two tables (orders, agents) i’m trying to join on either of the two columns but not both. There are some records in orders that have both of these columns populated and it returns as duplicate orders: agents: I tried joining with an OR clause I’m getting the following results Expected Results It looks in the case where both

Advertisement