SELECT *
FROM table1,table2
WHERE table2.start <= table1.end
AND (table2.end IS NULL OR table2.end >= table1.start)
More Related Contents:
- How do I create a parameterized SQL query? Why Should I?
- Auto Increment after delete in MySQL
- Left Join With Where Clause
- SELECT * EXCEPT
- Update table values from another table with the same user name
- Select max value of each group
- What is the string concatenation operator in Oracle?
- Using an Alias in a WHERE clause
- How can I define a composite primary key in SQL?
- How can I introduce multiple conditions in LIKE operator?
- How do I delete from multiple tables using INNER JOIN in SQL server
- Does Foreign Key improve query performance?
- SQL : BETWEEN vs =
- SQL query for finding records where count > 1
- Using sql function generate_series() in redshift
- SQL Server convert string to datetime
- How can I insert values into a table, using a subquery with more than one result?
- MySQL – Selecting data from multiple tables all with same structure but different data
- What is the equivalent PostgreSQL syntax to Oracle’s CONNECT BY … START WITH?
- Script to kill all connections to a database (More than RESTRICTED_USER ROLLBACK)
- can we list all tables in msaccess database using sql?
- String concatenation does not work in SQLite
- Using alias in query and using it
- Comparison of Relational Databases and Graph Databases
- How do I view grants on Redshift
- The difference between ‘AND’ and ‘&&’ in SQL
- How to detect query which holds the lock in Postgres?
- Query a Table’s Foreign Key relationships
- How to get the next number in a sequence
- Get the first and last date of next month in MySQL