score:1
Accepted answer
You can use the ISNULL solution like mentioned in the comments.
Another way you could write the query is this:
SELECT #t1.AccountID AS acct, #t1.Name AS [name], #t1.Address AS [add]
FROM #t1
LEFT JOIN #t2 ON #t1.AccountID = #t2.AccountNo
AND #t2.type = 'ex' --In case you add additional types to #t2
WHERE #t2.AccountNo IS NULL;
More questions
- Query Using != On LEFT JOIN Table Returns No Result
- Sql query , grouping result from left outer join to a single cell/field of main table
- Inner Join with derived table using sub query
- SQL QUERY using LEFT JOIN and CASE Statement
- SQL query - Join that returns the first two records of joining table
- Avoid specifying every table field in GROUP BY clause when using Left Join
- SQL Using inner query in left join
- Update Table value from other table using LEFT OUTER JOIN
- If there a way I can inner join a MS Sql table to a MySql Table in one query using MySql?
- Select for JSON with LEFT JOIN returns single element array when no data in the right table
- Using the result of a CTE to query from table without cursor
- fetch records from four different table using join query
- Query one left table and two right tables UNION result without union operator
- Duplicate Row inserted in individual table while insert using multiple table left join
- How to display all record from left table using left join in my case using SQL Server?
- Trying to access an XML node value from a table column using query in SQL Server and it always returns an empty string
- Fetch result from function that returns table from query
- MS Access - SQL query - NVARCHAR(MAX) is cut off when using DISTINCT keyword in LEFT JOIN
- SQL query with Left Join to return results when the top 1 column of joined table matches column of main table
- Join a temporary table to query result in SQL
- Error when using left join with my query
- Select query with joins display count result depend on third join table value
- Inner Join with two tables, and Left Join the result with another table
- VBA: object is closed error in sql query when using a join table
- Left Join row using pairing id table
- Join table with another table in a seperate database using NHibernate Query Language HQL
- SQL Left Join query with Where Clause drops some rows from first table
- Join two table using sql query
- Not able to write left outer join for same table query in MS Access database
- Insert into table as many results row returns from subquery along with outer query result
More questions with similar tag
- Converting from base64 string to varbinary(max) in SQL Server
- How to check correctly if a temporary table exists in SQL Server 2005?
- I get an error for inserting data into SQL Server via VB.Net
- Extracting a string within a string between "[" and "]"
- Create Fulltext index on decimal/number coloumn, possible????? (SQL Server 2008)
- Find out the values between a range in SQL Server 2005(SET BASED APPROACH)?
- Deploy single RDL file SSRS report
- SQL search with logical operators
- Comment Count on Entry Table (SQL Query)
- SQL Merge from staging table causing duplicate rows
- Column Name or Values supplied do not match table definition
- Find date of most recent overdue
- TIBCO Spotfire Advanced Data Services = data warehouse
- Correlate SQL Server version # to name
- See updates in a DataReader
- Why do we need SQL functions when stored procedures can do all what SQL function does?
- Should I include all of my columns from the select in my index?
- Find Deadlock details happened one day ago in SQL Server
- Dynamic survey application logic PHP/MSSQL
- No column name was specified for column 1 of 'sp'
- need count of Range in sql query
- SQL IN function and select not match criteria
- Using Recursive CTE with GroupBy
- How to Fix "Unable to create restore plan due to break in the LSN chain" When Using the Restore Wizard in SQL Server Management Studio
- How to return multiple rows in sql from same table
- How to sum up multiple time records on a given date in database. Error:Subquery returned more than 1 value
- Is it Possible to declare Cursor within IF Condition in MySQL UDF
- PowerBI Online vs Desktop Credentials for SQL Server
- Inserting multiple child elements from XML into SQL Server database
- Total number calculations
Source:
stackoverflow.com