Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

find rows that don't match

Status
Not open for further replies.

wouter0809

Technical User
Nov 29, 2002
1
NL
I've got two tables: item an trial
The answer to the items is saved in table trial.
I want to select those items that haven't been made in the current session.
The answer to the items is saved in table trial.

I used:

select item.item_id, trial.test.session_id
from item left join trial
using(item_id)
where trial.item_id is null

this selects the items that havent been made yet.

It should retrieve all items in a new session
But retrieves only those that haven't been made in the old session.

how can I add an extra line that like:

and trial.session_id=&quot;<current_session>&quot;

select item.item_id, trial.test.session_id
from item left join trial
using(item_id)
where trial.item_id is null
and trial.session_id=&quot;<current_session>&quot;

this returns: there is no data macthving your request.

can somebody help me out??

thanx

Wouter Pasman
 
Wouter

I tried the following with a similar issue, which worked:

select a.Ref, b.Ref
from ATable a left outer join BTable b
on a.Ref = b.Ref
where a.Ref is null


(If I had tried b.Ref, the response would have been a failure because there would have been no null records. In this case, I would have either switched the order of the tables in the &quot;from&quot; statement, or replaced &quot;left outer&quot; with &quot;right outer&quot;.)

I hope this fixes your problem
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top