Transact SQL :: Left Outer Join And Transaction Isolation Level

Nov 30, 2015

We have a service that inserts some rows into a parent table (P) and child table (C). This operation is atomic and performed within a transaction.

We also have a service that queries these tables such that rows are (should only be) returned from P where there are no children for that parent.

The SQL that performs this is simplified below:

SELECT P.SomeCol
FROM P
LEFT OUTER JOIN C ON P.PKofP_Value = C.PkofP_Value
WHERE
C.PkofPValue IS NULL
AND P.SomeOtherCol=0

Our expectation is that the query service should only return rows from P where there are no rows in C.

However, this seems not to be the case, and occasionally we find that rows from P are returned where there are matching rows in C.

We are sure that the process that inserts rows into P and C does so within a single transaction.

We have traced this with SQLTrace and can see the txn stag and committing and all operations using the same transactionid within the transaction.

We are running the default isolation level committed.

In SQLTrace we can see the query process start, the inserter process start and complete and then the query process continue (after presumably being blocked).

So how can the query process "miss" the child rows and return the parent from the above query?

Is it possible that, in this isolation level, the inserter process can block the query process such that when the inserter process commits and when the query process continues it does not see the child rows inserted because they were inserted in the table/index "behind" where the query process has already read - some kind of phantom phenomenon?

View 3 Replies


ADVERTISEMENT

Transact SQL :: Difference Between Inner Join And Left Outer Join In Multi-table Joins?

Oct 8, 2015

I was writing a query using both left outer join and inner join.  And the query was ....

SELECT
        S.companyname AS supplier, S.country,P.productid, P.productname, P.unitprice,C.categoryname
FROM
        Production.Suppliers AS S LEFT OUTER JOIN
        (Production.Products AS P
         INNER JOIN Production.Categories AS C

[code]....

However ,the result that i got was correct.But when i did  the same query using the left outer join in both the cases

i.e..

SELECT
        S.companyname AS supplier, S.country,P.productid, P.productname, P.unitprice,C.categoryname
FROM
        Production.Suppliers AS S LEFT OUTER JOIN
(Production.Products AS P
LEFT OUTER JOIN Production.Categories AS C
ON C.categoryid = P.categoryid)
ON
S.supplierid = P.supplierid
WHERE
S.country = N'Japan';

The result i got was same,i.e

supplier     country    productid    productname     unitprice    categorynameSupplier QOVFD     Japan     9     Product AOZBW    97.00     Meat/PoultrySupplier QOVFD    Japan   10     Product YHXGE     31.00     SeafoodSupplier QOVFD     Japan   74     Product BKAZJ    10.00     ProduceSupplier QWUSF     Japan    13     Product POXFU     6.00     SeafoodSupplier QWUSF     Japan     14     Product PWCJB     23.25     ProduceSupplier QWUSF    Japan     15    Product KSZOI     15.50    CondimentsSupplier XYZ     Japan     NULL     NULL     NULL     NULLSupplier XYZ     Japan     NULL     NULL     NULL     NULL

and this time also i got the same result.My question is that is there any specific reason to use inner join when join the third table and not the left outer join.

View 5 Replies View Related

Left Join Vs Left Outer Join Syntax Generates Different Execution Plans

Apr 16, 2008



Anyone know why using

SELECT *
FROM a LEFT OUTER JOIN b
ON a.id = b.id
instead of

SELECT *
FROM a LEFT JOIN b
ON a.id = b.id

generates a different execution plan?

My query is more complex, but when I change "LEFT OUTER JOIN" to "LEFT JOIN" I get a different execution plan, which is absolutely baffling me! Especially considering everything I know and was able to research essentially said the "OUTER" is implied in "LEFT JOIN".

Any enlightenment is very appreciated.

Thanks

View 5 Replies View Related

Transaction Isolation Level

Sep 10, 2002

Hello all,

What is the TRANSACTION ISOLATION LEVEL settings for MSSQL like the default setting in Oracle. In Oracle the default setting allows one session to read consistent data without waiting for the other sessions to commit/rollback the data.

For eg: In Mssql, if I update table A in the first session, and in another session (second session) if I select from table A, the second session waits till the first session completes the updates and commit or rollbacks.

But in Oracle , if I update table A in the first session, and in another session (second session) if I select from table A, the second session will perform a read from the ROLLBACK SEGS and give a read consistent data without waiting for the first session to commit or rollback the transaction.

Is this type of behaviour is possible is MSSQL. And If YES how can I do it?

Thanks for any help
Suresh

View 10 Replies View Related

Transaction Isolation Level

Jul 24, 2007

Not sure if this is more a .Net question or SQL Server, but I think it belongs here.

I have a small .Net app that reads records from a bunch of files from disk and inserts them into a database table. There could be several hundred files resulting in 100,000 records or more each time its run. Since it's a large table there are of course a few indexes on it so the insert takes a while. For larger sessions it could run as long as an hour. I need it to run in a transaction so that if anything happens while it's running the records from that run were committed on an all or nothing basis. However, I don't want to lock the table at all while the insert is happening. These aren't transaction records or anything like that, and the batches are separated by client so there will be no conflicts (no need to lock the table).

Unfortunately, no matter what I use for the isolation level of the transaction the table always ends up locked for reads. Data from previous runs is live at this point and we can't allow that. I have the choice of the following isolation levels when I create the transaction, but none seems to work:
Chaos
ReadCommitted
ReadUncommitted
RepeatableRead
Serializable
Snapshot
Unspecified

I would expect Chaos, ReadUncommitted, or Snapshot be okay here, but I can't seem to get it working. Any thoughts?

View 4 Replies View Related

Transaction Isolation Level

Nov 3, 2007

Hi,I have 1 SQL statement selecting data from various tables and updating othertables.The question then is how do I prevent other applications from modifying thetables that I'm working on (that is while my transaction is being executed)?I know that the isolation level should be either REPEATABLE READ orSERIALIZABLE. But I need confirmation on if one of these actually solve myissue - prevents other applications/threads from modifying/inserting datainto the same tables that I'm working on.Thanks in advance,Daniel

View 5 Replies View Related

What Is Transaction Isolation Level In MS SQL?

Mar 20, 2008

What are the different kinds of Transaction Isolation Level? How they useful in day to day activity as SQL Developer ?

View 2 Replies View Related

Setting Transaction Isolation Level

May 6, 2015

By setting the TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; is this automatically sets all the joined tables to NOLOCK?

Or, in order this statement to work right, this needs to be only done inside BEGIN TRAN > COMMIT (ROLLBACK) statement?

View 7 Replies View Related

Isolation Level In NON-Transaction Queries

May 19, 2008

I need to set the Isolation Level (in ADO) for the Non-transaction queries to SNAPSHOT.

Both the ADO.Connection.IsolationLevel Property and the SQL Server SET TRANSACTION ISOLATION LEVEL command set the Isolation Level for the Transaction queries but no for the non-transaction queries.

I cannot use the READ_COMMITTED_SNAPSHOT database option, becaus when I am in a transaction I need the READ COMMITTED Isolation Level not the SNAPSHOT Isolation Level.

I don't want to rewrite the entire code of my existing application to add (NOLOCK).

Thanks,

View 10 Replies View Related

What Is The Default Transaction Isolation Level For SQL Server?

Dec 7, 2000

What is the default transaction isolation level for SQL Server?
and Advantages of having multiple filegroups ?

View 1 Replies View Related

Question About Transaction Isolation Level=readCommitted

May 23, 2007

I have a question about the "readCommitted" transaction isolation level.I have a client that is updating a record on a table.I suspend the execution after the UPDATE but before the commit statement.Than another client is trying to read the same record.As transaction isolation is set to "readCommited" I expected that the secondclient will read the old version of the record (before the update).Instead, the second client hangs and wait until the first client do thecommit.I expect this behavior if transaction isolation is set to "serializable"Is this behavior correct?Thanks,D.

View 3 Replies View Related

'Left Outer Merge Join' Failing To Join Valid Row

Aug 10, 2007

Scenario:

OLEDB source 1
SELECT ...
,[MANUAL DCD ID] <-- this column set to sort order = 1
...
FROM [dbo].[XLSDCI] ORDER BY [MANUAL DCD ID] ASC


OLEDB source 2
SELECT ...
,[Bo Tkt Num] <-- this column set to sort order = 1
...
FROM ....[dbo].[FFFenics] ORDER BY [Bo Tkt Num] ASC

These two tasks are followed immediately by a MERGE JOIN

All columns in source1 are ticked, all column in source2 are ticked, join key is shown above.
join type is left outer join (source 1 -> source 2)

result of source1 (..dcd column)
...
4-400-8000119
4-400-8000120
4-400-8000121
4-400-8000122 <--row not joining
4-400-8000123
4-400-8000124
...


result of source2 (..tkt num column)
...
4-400-1000118
4-400-1000119
4-400-1000120
4-400-1000121
4-400-1000122 <--row not joining
4-400-1000123
4-400-1000124
4-400-1000125
...

All other rows are joining as expected.
Why is it failing for this one row?

View 1 Replies View Related

SQL 2012 :: Transaction Isolation Level And Distributed Transactions

Mar 5, 2015

I vaguely remember reading somewhere that all distributed transactions are executed at Serializable Isolation Level "under the covers."

1. Is this true?
2. What does "under the covers" mean in this case; i.e. will I not see the isolation level represented accurately in requests?

View 9 Replies View Related

Transaction Reading From Linked Server Without DTC? (Isolation Level?)

Feb 9, 2006

Is there a way to read data from a linked server,within a transaction, without using DTC?The data on the linked server is static, thereforethere is no need for two-phase commit. There isno need for locking data on the linked server, becauseit is not being updated (either from the remote server,or from the local server).I don't want to run DTC because:1.) there have been security-related flaws with DTC inthe past2.) the application doesn't do distributed updates, andbecause the data on on the remote server is static,there is really no data integrity exposure withoutDTC.I cannot specify "WITH (NOLOCK)" on the select fromthe linked server:Server: Msg 7377, Level 16, State 1, Line 6Cannot specify an index or locking hint for a remote data source.I tried setting the isolation level:SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTEDbut that seems to have no effect on the requirement to use DTC.I still get the message:MSDTC on server 'LOCALSERVER' is unavailable.Is there some other way around this? Is it possible to provide someconnection string parameter, in the linked server setup, that wouldspecify the "READ UNCOMMITTED" isolation level for the linked server,so that DTC wouldn't be necessary.(In other words, can I tell SQL Server, "trust me, this won't hurt"?)Environment: SQL Server 2000 sp4The SQL does something like:declare @x char(4), @k int, @rc1 int, @rc2 intset @k=123BEGIN TRANselect @x=xfrom remoteserver.remotedatabase.dbo.tablewhere k=@kupdate localdatabase.dbo.table1set x=@xwhere k=@kset @rc1=@@errorupdate localdatabase.dbo.table2set x=@xwhere k=@kset @rc2=@@errorif (@rc1 = 0 AND @rc2=0) COMMIT TRANelse ROLLBACK TRAN

View 2 Replies View Related

Exclusives Locks With Transaction Isolation Level Readuncommitted

Mar 12, 2008

Hello,

I have some locks issues on production database (win 2k3 SP1, sql server 2k5).
In fact, I have an asynchronous process that makes SELECT TOP 1 in a table and UPDATE the selected row. The transaction isolation level for doing this action is READUNCOMMITTED.
The isolation level readuncommitted is ignored for the update if I'm not wrong.
On the other hand, I have some transactional activities with the isolation level read uncommitted too.

But when I control the database activity, I find very often locks between the asynchronous part and the transactional part. This is the transactional activity that is locking the asynchronous activity.
The transactional activity is a simple SELECT and this type of query, in spite of the isolation level readuncommitted, makes exclusives locks when the asynchronous makes LCK_M_U.

I tried to modify the strored procedure for the SELECT/UPDATE of the asynchronous process with a "UPDATE my_table ... FROM my_table" query in order to reduce the transaction time. But the problem is always present.

Can someone help me to understand how a select query with the isolation level readuncommtted can make exclusives locks ?

Thanks in advance.

View 2 Replies View Related

DELETE Transaction With SNAPSHOT Isolation Level - Conflicts Another Table

Nov 29, 2007

 



Hi,we are executing the following query in a stored procedure using snapshot isolation level:DELETE FROM tBackgroundProcessProgressReportFROM         tBackgroundProcessProgressReport LEFT OUTER JOIN                      tBackgroundProcess ON                      
tBackgroundProcess.BackgroundProcessProgressReportID =
tBackgroundProcessProgressReport.BackgroundProcessProgressReportID LEFT
OUTER JOIN                      tBackgroundProcessProgressReportItem ON                      
tBackgroundProcessProgressReport.BackgroundProcessProgressReportID =
tBackgroundProcessProgressReportItem.BackgroundProcessProgressReportIDWHERE     (tBackgroundProcess.BackgroundProcessID IS NULL) AND                       (tBackgroundProcessProgressReportItem.BackgroundProcessProgressReportItemID IS NULL)The query should delete records from tBackgroundProcessProgressReport which are not connected with the other two tables.However, for some reasone we get the following exception:System.Data.SqlClient.SqlException:
Snapshot isolation transaction aborted due to update conflict. You
cannot use snapshot isolation to access table 'dbo.tBackgroundProcess'
directly or indirectly in database 'RHSS_PRD_PT_Engine' to update,
delete, or insert the row that has been modified or deleted by another
transaction. Retry the transaction or change the isolation level for
the update/delete statement.The exception specifies that we are
not allowed to update/delete/insert records in tBackgroundProcess, but
the query indeed deletes records from tBackgroundProcessProgressReport,
not from the table in the exception.Is the exception raised because of the join?Has someone encountered this issue before?Thanks,Yani

View 1 Replies View Related

SQL Server 2014 :: Transaction Isolation Level And Implicit Transactions

Oct 23, 2015

I'm investigating a poorly performing procedure that I have never seen before. The procedure sets the transaction isolation level, and I suspect it might be doing so incorrectly, but I can't be sure. I'm pasting a bastardized version of the proc below, with all the names changed and the SQL mucked up enough to get through the corporate web filters.

The transaction isolation level is set, but there is no explicit transaction. Am I right that there are two implicit transactions in this procedure and each of them uses snapshot isolation?

SET NOCOUNT ON;
SET TRANSACTION ISOLATION LEVEL SNAPSHOT;
DECLARE @l_some_type varchar(20),
@some_type_code varchar(3),
@error int,
@error_msg varchar(50);

[Code] .....

View 4 Replies View Related

Left Outer Join-please Help!

Jan 7, 2002

Hello!
I need to write a query using left outer join and I'm having trouble with it.
I have 2 tables:customer and cust_info.
I want to pull all records from customer table and cust_info table even if there is no related data in cust_info table.
But I need one condition in this query:only records from customer table where cus_type in ("A","B","C").
I don't need all other types ("D","E").

So my query looks like this:

select customer.cus_name,customer.cus_address,customer.cu s_type,cus_info.status
from customer
left outer join cus_info ON customer.sxdat_pk = cus_info.sxdat_pk
and cus_type in ("A","B","C")
AND cus_info.cus_table = 'CUSTOMER'

The result should be like this:

cus_name cus_address cus_type status
Amoco 457 bent A new
Bingo 47 lone oak C NULL
Sears 1020 Magic dr. B exist


But my query pulls records for customers with type "D" and "E" that I'm trying to exclude from result.


Please help.
Thanks,
lena

View 4 Replies View Related

Left Outer Join?

Jun 17, 2008

Hi there,

I have three tables
Job
JobID
WeightIn
WeightOut

Operator
OperatorID
NameFirst
NameLast

JobOperator
JobOperatorID
JobID
OperatorID

a job can be done with 1 or more operators
I want to be able to show user both assigned and unassigned operator on the front end on a certain job so I haev only parm being passed in @jobID.

How do I got about showing all the operators but somehow differentiate ones already assigned to job

Thanks!

View 5 Replies View Related

Left Outer Join

Dec 4, 2006

Good evening!

Well,in relational algebra we have left outer join.
In SQL is any command for that?
How can i use left outer join?

View 20 Replies View Related

Left Outer Join

Jan 15, 2007

I'm relatively new to SQL and I am wondering about when to use left outer joins. When should you use left outer joins?

View 2 Replies View Related

Left Outer Join

Sep 4, 2007

How can user left outer join with three tables ?
it retreive all employees name if position and department
are not found

fields
--------
department_code
position_code

position_code and department_code include in employee table


SELECT e.name,e.position_code
FROM employee e LEFT OUTER JOIN position p
ON e.position_code = p.position_code

regards
Mateen

View 4 Replies View Related

Left Outer Join With &<&>

Sep 12, 2007

I am using following query


SELECT e.rec_id,e.EMP_ID,e.FIRST_NAME,e.PROJECT_ID,
e.DEPARTMENT_CODE, e.POSITION_CODE,e.WORKING_STATUS,
d.department_name,p.position_name, c.country_code,
c.country_name
FROM employee e LEFT OUTER JOIN position p
ON e.position_code = p.position_code LEFT OUTER JOIN department d
ON e.department_code = d.department_code left outer join country c
ON e.country_code = c.country_code


where I use
where e.working_status <>'left company'

it retreive few records, it shoud display all records except where
e.working_status <> 'left company'
i.e. left outer join is not working,

we have approx 1000 employee records, 100 employee left the company.
it should show 900 employee records
but is show few records,
how can use where clause in left outer join it show all records
except where e.working_status <> 'left company'

Thanks
Mateen

View 6 Replies View Related

LEFT OUTER JOIN

Oct 23, 2007

Hi All,

This is my first post to the forums. Can anyone tell me what is wrong with the following statement: -

SELECT V.VNUMBER,
V.PARAMETERID,
V.SEQUENCENUM,
V.VALUE,
V.GROUPID,
G.DESCRIPTION,
V.ENTRYDATE,
V.COMMENTS,
P.PARAMETERLABEL,
P.CATEGORY,
P.FIELDSCALE
FROM VBS_PARAMETERSP, (VBS_VOLUNTEER3 V LEFT OUTER JOIN VBS_GROUPS G)
ON V.GROUPID = G.GROUPID
AND P.PARAMETERID= V.PARAMETERID
WHERE V.PROSAMPLEID= 1

I'll appreciate a response.

Many Thanks,

I.A

View 14 Replies View Related

Left Outer Join

Jan 26, 2008

Hi iam new to sql forum can you send sample code for left outjoin
and right outer join

Desikankannan

View 1 Replies View Related

Need Help With Left Outer Join...

Sep 15, 2005

I have a SQL query I'm invoking via VB6 & ADO 2.8, that requires three"Left Outer Joins" in order to return every transaction for a specificset of criteria.Using three "Left Outer Joins" slows the system down considerably.I've tried creating a temp db, but I can't figure out how to executetwo select commands. (It throws the exception "The column prefix'tempdb' does not match with a table name or alias name used in thequery.")Looking for suggestions (and a lesson or two!) This is my first attemptat SQL.Current (working, albeit slowly) Query BelowTIASELECTLEDGER_ENTRY.entry_amount,LEDGER_TRANSACTION.credit_card_exp_date,LEDGER_ENTRY.entry_datetime,LEDGER_ENTRY.employee_id,LEDGER_ENTRY.voucher_explanation,LEDGER_ENTRY.card_reader_used_ind,STAY.room_id,GUEST.guest_lastname,GUEST.guest_firstname,STAY.arrival_time,STAY.departure_time,STAY.arrival_date,STAY.original_departure_date,STAY.no_show_status,STAY.cancellation_date,FOLIO.house_acct_id,FOLIO.group_code,LEDGER_TRANSACTION.original_receipt_idFROMmydb.dbo.LEDGER_ENTRY LEDGER_ENTRY,mydb.dbo.LEDGER_TRANSACTION LEDGER_TRANSACTION,mydb.dbo.FOLIO FOLIOLEFT OUTER JOINmydb.dbo.STAY_FOLIO STAY_FOLIOONFOLIO.folio_id = STAY_FOLIO.folio_idLEFT OUTER JOINmydb.dbo.STAY STAYONSTAY_FOLIO.stay_id = STAY.stay_idLEFT OUTER JOINmydb.dbo.GUEST GUESTONFOLIO.guest_id = GUEST.guest_idWHERELEDGER_ENTRY.trans_id = LEDGER_TRANSACTION.trans_idAND FOLIO.folio_id = LEDGER_TRANSACTION.folio_idAND LEDGER_ENTRY.payment_method='3737******6100'AND LEDGER_ENTRY.property_id='abc123'ORDER BYLEDGER_ENTRY.entry_datetime DESC

View 1 Replies View Related

Or In Left Outer Join.

Jul 20, 2005

What is the result of adding an or into a left outer join?For example:Selectl.list_id,l.request_idFrom List lleft outer join Request ron l.request_id = r.request_id or l.list_id = r.list_idThanks :)

View 1 Replies View Related

LEFT OUTER JOIN

Dec 20, 2007

Hi,

I have come across this type of a query.


SELECT T1.*, T2.*, T3.*, T4.*

FROM T1

LEFT OUTER JOIN T2 ON T1.aaa = T2.bbb

LEFT OUTER JOIN T3 ON T2.bbb = T3.ccc

LEFT OUTER JOIN T4 ON T3.ccc = T4.ddd

WHERE T1.aaa = @p1


Is this correct?

For the first join T1 is the left table. What about second and third joins? are the left tables T2 and T3 resp or T1 itself?


Thanks in advance

P

View 1 Replies View Related

Left Outer Join? Or Not?

Aug 7, 2007

I am trying to get a query to work and having trouble. I have two tables. I want all records in my left table plus null in the right table if no matching records exist or one record only if there are matching records. What I don't want is multiples if there is more than one match in the right table.

So if I use this:
select * from contacts left outer join sales on contacts.id = sales.contactid

I will get more than one record per contact if there is more than one sale. I only want one record per contact even if there is more than one sale.

How would I accomplish this?

View 3 Replies View Related

LEFT OUTER JOIN

Sep 27, 2006

Hi All,

Greetings! I have a problem converting *= to LEFT OUTER JOIN.
Here's my code that will retrieve a single record when executed:

SELECT *
FROM ar_t_memo_hdr A,
ar_r_trbal_cust_tmp B,
common..fs_currency_master E,
ar_reval_history rev

WHERE A.company_no = 'RAM'
AND A.company_locn = 'BANG'
AND E.fs_company_code = 'RAM'
AND E.fs_locn_code = 'BANG'
AND A.currency = E.fs_curr_code
AND A.memo_type = 'DM'
AND A.cust_no = B.cust_no
AND A.so_locn = B.so_locn
AND B.host_id = 100
AND A.memo_dt <= '2006-09-25 00:00:00.000'
AND A.unapplied_amt >= 0
AND
(
(CONVERT(varchar,A.reversal_dt,101) > '2006-09-25 00:00:00.000' AND A.status = 'V')
OR (a.status ='A')
)
AND A.company_no *= rev.company_no
AND A.company_locn *= rev.company_locn
AND A.cust_no *= rev.cust_no
AND B.cust_no *= rev.cust_no
AND B.so_locn *= rev.so_locn
AND A.memo_type *= rev.document_type
AND A.memo_no *= rev.document_no
AND rev.created_date = (SELECT MAX(his.created_date)
FROM ar_reval_history his
WHERE his.company_no = rev.company_no
AND his.company_locn = rev.company_locn
AND his.document_no = rev.document_no
AND his.document_type = rev.document_type
AND his.rev_dt <= DATEADD(dd,1,'2006-09-25 00:00:00.000'))

After replacing *= with LEFT OUTER JOIN, the above query returns nothing.
Could some one please help me resolve the problem??

Thank you,
Chaithanya

View 3 Replies View Related

LEFT OUTER JOIN

Dec 20, 2007

Hi,

I have come across this type of a query.


SELECT T1.*, T2.*, T3.*, T4.*

FROM T1

LEFT OUTER JOIN T2 ON T1.aaa = T2.bbb

LEFT OUTER JOIN T3 ON T2.bbb = T3.ccc

LEFT OUTER JOIN T4 ON T3.ccc = T4.ddd

WHERE T1.aaa = @p1


Is this correct?

For the first join T1 is the left table. What about second and third joins? are the left tables T2 and T3 resp or T1 itself?


Thanks in advance

P

View 1 Replies View Related

Left Outer Join

Apr 18, 2008



Need some assist - not sure I am using right join? I am using a Left Outer join -
Table A - has Cust # and Cust Name
Table B - has Cust #

If there are 2 entries with same Cust # and a slight difference in spelling of cust name, I get 2 entries. Looking to get 1 row based on cust #, regardless of spelling of name?

Thanks

View 2 Replies View Related

Left Outer Join

Apr 12, 2006

Hi All Dudes and Dudesses

Please help... I've got Two tables, Problem and Breach, in DB Support. The main Table (Problem) has a primary key on field Number and I retrieve most of my data from this table but the other fields are irellevant. The Breach Table includes fields: Number & Keyword. I use an Left Outer Join to connect from Problem.Number to Breach.Number and retrieve the Breach.Keyword if any. If there's no records in Breach it still retrieves all the Problem.Numbers and that's great but when there's more than one Breach.Keyword for the Problem.Number I retrieve more than one record at this stage but I would only like to retrieve one. My Query:

Select

Support_Problem.Number, Breach.Keyword

From

Support_Problem Support_Problem

Left Join Support_Breach Support_Breach ON Support_Problem.Number=Support_Breach.Number

View 10 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved