473,402 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Inverse query - greatly puzzling!

Hi all,
I am trying to create a query which will select the inverse of the
records returned.

Scenario:
Member(MEMBERID,name, address,etc)
Video(VIDEOID, title, certificate, etc.)
Rentals(RENTALID, memberid, videoid, datedueback, returned)

The videos currently rented out are the ones where returned = no. How
can I do an inverse of this, ie. the ones which ARE in stock?

Regards
Richard W
Nov 13 '05 #1
1 2945
A video is still out if Returned = No for its most recent rental (based on
DateDueBack).

Use a subquery in the Where clause:

SELECT Video.* FROM Video
WHERE (SELECT TOP 1 Returned FROM Rentals
WHERE (Rentals.VideoID = Video.VideoID)
ORDER BY Rentals.DateDueBack, Rentals.RentalID ) = False;

If subqueries are a new idea, you can read more about them in:
How to Create and Use Subqueries
at:
http://support.microsoft.com/?id=209066

BTW, the above assumes that VideoID uniquely identifies a copy of a video.
You don't actually hire out a video title, but a particular instance (copy)
of the disk/tape.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Richard Williamson" <ri*****************@ntlworld.com> wrote in message
news:62*************************@posting.google.co m...
Hi all,
I am trying to create a query which will select the inverse of the
records returned.

Scenario:
Member(MEMBERID,name, address,etc)
Video(VIDEOID, title, certificate, etc.)
Rentals(RENTALID, memberid, videoid, datedueback, returned)

The videos currently rented out are the ones where returned = no. How
can I do an inverse of this, ie. the ones which ARE in stock?

Regards
Richard W

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: David C. Fox | last post by:
Is there a function which takes a list of tuples and returns a list of lists made up of the first element of each tuple, the second element of each tuple, etc.? In other words, the the inverse...
2
by: Tim Fountain | last post by:
We've recently enabled slow query logging on a server and it's proving interesting seeing which queries are bogging things down. This one is puzzling me a little: SELECT articleid, type,...
1
by: Andy | last post by:
I have drawn an icon. I used the the inverse color on the color window in order to get transparency. However, now the inverse color has stopped working by some reason. Why is this? I press and...
1
by: j.mandala | last post by:
I created a simple link between two tables in a query. TableA has Social Security numbers stored as Long Integer Data. (I imported this table). The Join is between these two fields Table ...
6
by: vishnu mahendra | last post by:
hello to all, can any one please give me an algorithm to find inverse of a matrix of order n rows and m columns. thank you in advance, vishnu.
9
by: Water Cooler v2 | last post by:
What is the inverse of the sine function? I've been pulling my hair and I have no clue nor memory of how to go about solving this little expression: sine-1 (read sine inverse) of (1-(x/y)) An...
3
by: Smokey Grindle | last post by:
How can you "inverse" a color in GDI+? Say the color I have is blue, the inverse of that is yellow... how would you go about doing this? is there a simpler way then taking the RGB values and...
2
by: StuckProgrammer | last post by:
Hi, I have 10 queries linked together via an incident number. There is a form where the user enters start and end dates to define which incident numbers are used within the queries. On running...
4
by: Jonathan Fine | last post by:
Hello As part of the MathTran project I found myself wanting to maintain a bijection between long names and short names. http://www.open.ac.uk/mathtran In other words, I wanted to have two...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.