I have 2 subqueries, but I’m having trouble joining columns together from the same tables. I tried:
SELECT * FROM (SELECT userid, listid FROM user_views_table WHERE date='2013-05-15' AND view_type='lists') a JOIN (SELECT sourceid, destinationid FROM actions_table WHERE date='2013-05-15' AND payloadtype='lists_user' AND actiontype='delete') b ON a.userid = b.sourceid ON a.listid = b.destinationid;
If I simply end the query with ON a.userid = b.sourceid
it works, but how can I also join these tables on another column also ON a.listid = b.destinationid
??
Any help appreciated.
Related Posts:
- What is the difference between “INNER JOIN” and “OUTER JOIN”?
- What is the difference between “INNER JOIN” and “OUTER JOIN”?
- SQL Inner-join with 3 tables?
- How can I do a FULL OUTER JOIN in MySQL?
- Difference between JOIN and INNER JOIN
- What is the difference between JOIN and UNION?
- MySQL Multiple Joins in one query?
- Join vs. sub-query
- What is a stored procedure?
- Unknown column in ‘field list’ error on MySQL Update query
- Self Join to get employee manager name
- Conversion failed when converting date and/or time from character string while inserting datetime
- MySQL create table if not exists and insert record only if table was created
- error, string or binary data would be truncated when trying to insert
- ORA-00907: missing right parenthesis
- Rename column SQL Server 2008
- Why do we need “Relationships” between tables at all?
- Using group by on multiple columns
- Case statement in MySQL
- How to declare a variable in MySQL?
- ORA-01843 not a valid month- Comparing Dates
- How do I escape a single quote in SQL Server?
- Teradata: how to convert varchar value (format ‘dd.mm.yyyy’) to date (format ‘yyyy-mm-dd’ )?
- How Stuff and ‘For Xml Path’ work in SQL Server?
- Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)
- Oracle SELECT TOP 10 records
- MySQL: Invalid use of group function
- must appear in the GROUP BY clause or be used in an aggregate function
- How can I return pivot table output in MySQL?
- The multi-part identifier could not be bound
- MySQL syntax for Join Update
- Get day of week in SQL Server 2005/2008
- incorrect syntax error CREATE VIEW must be the only statement in the batch
- PLS-00103: Encountered the symbol when expecting one of the following:
- SQLite – UPSERT *not* INSERT or REPLACE
- ORA-00918: column ambiguously defined in SELECT *
- how to drop partition without dropping data in MySQL?
- Simple way to calculate median with MySQL
- The ALTER TABLE statement conflicted with the FOREIGN KEY constraint
- Error 1046 No database Selected, how to resolve?
- What is it exactly a BLOB in a DBMS context
- How do you create a temporary table in an Oracle database?
- Oracle SQL: Update a table with data from another table
- How to SUM and SUBTRACT using SQL?
- Simulate CREATE DATABASE IF NOT EXISTS for PostgreSQL?
- Postgresql tables exists, but getting “relation does not exist” when querying
- SELECT DISTINCT on one column
- TSQL PIVOT MULTIPLE COLUMNS
- MySQL – UPDATE multiple rows with different values in one query
- How to create a MySQL hierarchical recursive query?
- Microsoft OLE DB Provider for SQL Server error ‘80004005’
- SQL Parentheses use in an OR clause
- Is it possible to GROUP BY multiple columns using MySQL?
- What is the difference between LATERAL JOIN and a subquery in PostgreSQL?
- Equivalent of Oracle’s RowID in SQL Server
- Is there a Max function in SQL Server that takes two values like Math.Max in .NET?
- Best way to test if a row exists in a MySQL table
- Subtract one day from datetime
- The used SELECT statements have a different number of columns
- Get current year in TSQL
- Is it possible to specify condition in Count()?
- SQL Server: Make all UPPER case to Proper Case/Title Case
- How do I query for all dates greater than a certain date in SQL Server?
- Backup a single table with its data from a database in sql server 2008
- updating table rows in postgres using subquery
- Conditional JOIN Statement SQL Server
- Temporary table in SQL server causing ‘ There is already an object named’ error
- MySQL OPTIMIZE all tables?
- MySQL INSERT INTO table VALUES.. vs INSERT INTO table SET
- Is there a coalesce-like function in Excel?
- Text was truncated or one or more characters had no match in the target code page including the primary key in an unpivot
- How can I group by date time column without taking time into consideration
- How do I count unique items in field in Access query?
- Sqlite: CURRENT_TIMESTAMP is in GMT, not the timezone of the machine
- MySQL LIKE IN()?
- Filter data based on date in sql
- What is a postgres superuser
- ora-06553 pls-306 wrong number or types of arguments in call to ‘ogc_x’
- “This SqlTransaction has completed; it is no longer usable.”… configuration error?
- SQL query to extract only the “current” wp_posts?
- How to retrieve sticky post in raw sql?
- How to remove in the wordpress database all posts revisions except the last three?
- Backticks (`) Instead of Single Quotes (‘) in an SQL Statement?
- $wpdb get_var issue
- WP Optimization: Removing Orphaned wp_options (especially the autoload ones)
- Auto-update tables from database
- Inserting rows into a custom table, when plugin is activated
- dbDelta not creating table (yes, once more)
- Pull data and display as rows and columns
- I need a SQL command to delete specific authors and all posts connected with them
- Posts modified in the last 48 hours
- post id not displaying
- How to export 2 week’s worth of posts
- Do I need to sanitize $_POST[‘keyword’] before send to ‘s’ parameter?
- Insert multiple checkbox values
- Sql query returns empty. But not
- How to get EVENT based on startday, using BETWEEN
- wpdb prepare without placeholder
- This SQL request call all time and overload my server : SELECT meta_value FROM wp_sitemeta WHERE meta_key = ‘wp_installer_network’ AND site_id = 1
- Deleting the MySQL database