473,396 Members | 1,884 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,396 software developers and data experts.

need help with query

I have a table of "memos". each record in that table has a primary
key "memo ID" that is autonumber. I have another table that is "memo
receipts" with each record having a "receipt id" field that is not a
primary key. When a user reads a memo, I create a receipt record that
shows that they have read and acknowledged the memo. "receipt id" is
set equal to "memo id". I have this part working fine. Next what I
want is when a user checks for new memos, I want to display only those
memos that dont have a receipt record for that user. Any memos that
have a receipt record for the current user have already been read and
acknowledged by that user. I can display the memo records very well
using a Memo form with a receipt subform. This is great but I need to
be able to only show memos that have not already been acknowledged by
the current user.

Please help
Nov 13 '05 #1
5 1764
"Bob Weisenburger" <bo******@hotmail.com> wrote in message
news:77*************************@posting.google.co m...
I have a table of "memos". each record in that table has a primary
key "memo ID" that is autonumber. I have another table that is "memo
receipts" with each record having a "receipt id" field that is not a
primary key. When a user reads a memo, I create a receipt record that
shows that they have read and acknowledged the memo. "receipt id" is
set equal to "memo id". I have this part working fine. Next what I
want is when a user checks for new memos, I want to display only those
memos that dont have a receipt record for that user.


select * from memos as m
left outer join receipts as r on m.memoID = r.ReceiptID
where r.ReceiptID Is Null
Why not use a Receipt column in the memo table itself and do away with the
receipt table altogether. If you do keep the receipts table I susgest you
change the name ReceiptID to MemoID.


Nov 13 '05 #2
Try using an "unmatched query". This type of query will show records in one
table that don't have a matching record in the other table. To create this
type of query, go to the query tab of the database window and click the New
button. Don't use the New Query Using Wizard option in the window, use the
button on the database window. Next, choose Find Unmatched Query Wizard.

--
Wayne Morgan
MS Access MVP
"Bob Weisenburger" <bo******@hotmail.com> wrote in message
news:77*************************@posting.google.co m...
I have a table of "memos". each record in that table has a primary
key "memo ID" that is autonumber. I have another table that is "memo
receipts" with each record having a "receipt id" field that is not a
primary key. When a user reads a memo, I create a receipt record that
shows that they have read and acknowledged the memo. "receipt id" is
set equal to "memo id". I have this part working fine. Next what I
want is when a user checks for new memos, I want to display only those
memos that dont have a receipt record for that user. Any memos that
have a receipt record for the current user have already been read and
acknowledged by that user. I can display the memo records very well
using a Memo form with a receipt subform. This is great but I need to
be able to only show memos that have not already been acknowledged by
the current user.

Please help

Nov 13 '05 #3
Thanks Wayne, but I have already tried that. What happens is if a
memo was read by three other users other then there are repeipt
records for those users so there are "receipt id"s that match the
"memo id"s. The unmatched query only finds memo records that do not
have receipt records.

Please let me know if you have any other ideas.

thanks

"Wayne Morgan" <co***************************@hotmail.com> wrote in message news:<zx*****************@newssvr12.news.prodigy.c om>...
Try using an "unmatched query". This type of query will show records in one
table that don't have a matching record in the other table. To create this
type of query, go to the query tab of the database window and click the New
button. Don't use the New Query Using Wizard option in the window, use the
button on the database window. Next, choose Find Unmatched Query Wizard.

--
Wayne Morgan
MS Access MVP
"Bob Weisenburger" <bo******@hotmail.com> wrote in message
news:77*************************@posting.google.co m...
I have a table of "memos". each record in that table has a primary
key "memo ID" that is autonumber. I have another table that is "memo
receipts" with each record having a "receipt id" field that is not a
primary key. When a user reads a memo, I create a receipt record that
shows that they have read and acknowledged the memo. "receipt id" is
set equal to "memo id". I have this part working fine. Next what I
want is when a user checks for new memos, I want to display only those
memos that dont have a receipt record for that user. Any memos that
have a receipt record for the current user have already been read and
acknowledged by that user. I can display the memo records very well
using a Memo form with a receipt subform. This is great but I need to
be able to only show memos that have not already been acknowledged by
the current user.

Please help

Nov 13 '05 #4
"Bob Weisenburger" <bo******@hotmail.com> wrote in message
news:77**************************@posting.google.c om...
Thanks Wayne, but I have already tried that. What happens is if a
memo was read by three other users other then there are repeipt
records for those users so there are "receipt id"s that match the
"memo id"s. The unmatched query only finds memo records that do not
have receipt records.


Intsead of a narrative it's much better to post your actual (simplified)
table structure with some sample data and the output you need.

Will this work?

parameters [userid] varchar(50);
select * from memos as m
where not exists
(
select * from recipts as r
where r.ReceiptID = m.memoID
and r.userID = [userid]
)
Nov 13 '05 #5
"John Winterbottom" <as******@hotmail.com> wrote in message news:<2v*************@uni-berlin.de>...
"Bob Weisenburger" <bo******@hotmail.com> wrote in message
news:77**************************@posting.google.c om...
Thanks Wayne, but I have already tried that. What happens is if a
memo was read by three other users other then there are repeipt
records for those users so there are "receipt id"s that match the
"memo id"s. The unmatched query only finds memo records that do not
have receipt records.


Intsead of a narrative it's much better to post your actual (simplified)
table structure with some sample data and the output you need.

Will this work?

parameters [userid] varchar(50);
select * from memos as m
where not exists
(
select * from recipts as r
where r.ReceiptID = m.memoID
and r.userID = [userid]
)


Don't know how to put what you suggested in a query.
Nov 13 '05 #6

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

Similar topics

3
by: Masterpop | last post by:
Hi, I have the following table: Column 1 Column 2 A A A B A C B F B F
10
by: L. R. Du Broff | last post by:
I own a small business. Need to track a few hundred pieces of rental equipment that can be in any of a few dozen locations. I'm an old-time C language programmer (UNIX environment). If the only...
1
by: Aaron West | last post by:
Try this script to see what queries are taking over a second. To get some real output, you need a long-running query. Here's one (estimated to take over an hour): PRINT GETDATE() select...
0
by: vinod | last post by:
Dear experts i need a query like this i have a table like this. accno name amount running_total 1 a 50 50 2 ...
0
by: Rational Repairs | last post by:
I have a query situation I can't, for the life of me, figure out. Any help would be greatly appretiated. I have a table of customers, and a seperate table of orders. An order consists of (among...
1
by: kev | last post by:
Hi folks, Firstly, Happy New Year to all. I have some problems with query pls help.I have 4 tables namely Equipment,Safety1,Safety2,Safety3. some of the fileds in each table is shown below....
5
by: Karthik D V | last post by:
Hello All, I have a table like this ID CHARACTER ----------- --------- 1 A 2 A 3 B 4 B
2
by: viki1967 | last post by:
Hi everyone. I have this table : http://www.complessobandisticopalombarasabina.it/viki1967/immagine.jpg Need extraction query: ***************************************
4
by: muhammadrashidmughal | last post by:
columns f1 f2 f2 f4 f5 f6 f7 f8 ...... 1 2 3 4 ...
4
by: asivakrupa | last post by:
Hi, I need a query in SQL Sever which will select the records based on the date of creation.The query is, List the opportunity name where the date of creation is before 3 weeks. I do not...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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.