Search
 
SCRIPT & CODE EXAMPLE
 

SQL

get the rows from two tables whose relation is in 3rd table

/*

I have two tables Activity and Action.
 One or more actions can be performed for an activity.
 And the relationships between Activity and Action is
 given in a third table called Activity Action.

Here is the sql query to perform the action
*/
SELECT Activity.ActivityText as Activity,
 Action.ActionText as ApplicableAction
FROM ActivityAction
    INNER JOIN Activity
        ON ActivityAction.ActivityId = Activity.ActivityId
    INNER JOIN Action 
        ON ActivityAction.ActionId = Action.ActionId
Comment

PREVIOUS NEXT
Code Example
Sql :: fill a column in database with a value 
Sql :: psql autocomplete for mac brew install 
Sql :: tsql find foreign key references 
Sql :: how to copy data of a table from another database to table of anaother database 
Sql :: left join with only first record 
Sql :: postgres get timestamp 
Sql :: mysql bidirectional composite primary key 
Sql :: sql server utc to local 
Sql :: encoding UTF8 has no equivalent in encoding WIN1252 
Sql :: sql select roundup column 
Sql :: scaffold npgsql net core 
Sql :: how to check nls timestamp format in oracle 
Sql :: mysql drop column 
Sql :: sql select column names 
Sql :: get rows affected mysql python 
Sql :: postgres get database encoding 
Sql :: group by 15 minute interval sql server 
Sql :: how to delete a column in sql 
Sql :: Failed to connect to localhost:1433 - self signed certificate 
Sql :: postgres add superuser to database 
Sql :: mysql select utc time in eastern time 
Sql :: Oracle Column Names of a table 
Sql :: mysql login console 
Sql :: alter table in mysql 
Sql :: mysql select where not in multiple tables 
Sql :: select tables from mysql database 
Sql :: centos 8 install mysql 
Sql :: use of now() in mysql 
Sql :: real world example of nosql 
Sql :: mysql add fields 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =