EXIST QUERY IN ACCESS.....

navyaa

Board Regular
Joined
Jul 7, 2002
Messages
223
I am trying to write a query with the EXIST statement in access but it doesnt seem to be working. When i generate the query using access it uses an innerjoin but doesnt use EXIST and i need to use that for a class project..

I am making a library database with two tables called CHECK-OUT and LOCATION-TYPE and i am trying to write a query which gets the book title and description from the CHECKOUT table(we have other types of resources such as DVD'S AND TAPES..ETC) and
then the CHECKOUT also has a Loc-ID which tells us where each resource is located(the floor)

so our query has to first get all the books available and then have an exist statement which says where they are located in the library..

this is what i have right now:
SELECT [Check-Out].[Resource-Type], [Check-Out].Title
FROM [Check-Out]
WHERE ((([Check-Out].[Resource-Type])="B")
AND ((Exists (SELECT * FROM Location-Type WHERE ( Loc-ID = 'A-1') and ([Location-Type].[Loc-ID] = [Check-Out].[Loc-ID]) ))<>False));



Any suggestions will be very helpful!!
THANK YOU,
nAVYAA
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Hard to say w/o seeing your tables, but try something like this:

SELECT [Check-Out].[Resource-Type], [Check-Out].Title FROM [Check-Out] WHERE (Exists (SELECT * FROM Location-Type WHERE (([Location-Type].[Loc-ID] = [Check-Out].[Loc-ID]) AND ([Check-Out].[Loc-ID] = 'A-1') AND ([Check-Out].[Resource-Type]="B")))<>False);

HTH,

Russell
 
Upvote 0

Forum statistics

Threads
1,221,490
Messages
6,160,133
Members
451,622
Latest member
xmrwnx89

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top