473,840 Members | 1,458 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Users not connected query

I have a two tables, Users and Requests, the latter which displays the daily
log on's of 20 users. Both tables are related by a one-to-many relationship
in the Requests table via the UserId field.

I want to run a query that when I enter a date shows all the users that DID
NOT connect for that particular day. For example, say user id's 1 and 2
were on the system on a particular day but user id's 3 - 20 were not, how
do I display just the users that were not connected on that day. Using the
NOT LIKE ("DATE") shows all the remaining users not connected but obviously
returns all the remaining dates as well. Unfortunately, the Requests table
does not show users that are not connected as a Null field. So I cannot use
an Is Null criteria. A copy of some sample data from the Requests table is
shown below. Thus, if "22/02/2004" is the date I want to view Users that
were not connected, based on the data below I know that UserId 3 and the
rest (which I have not shown as it would be a long list!) were not logged on
that day. So how can I display just User Id's 3 to UserId(n). I have tried
using left joins but not having any success. Of the coding that has been
recommended it tends to just return all the UserId's instead of the ones
that are left.

Hope the above is makes the problem clearer. Many thanks and I hope someone
can help!

RequestId UserId RequestDate RequestType RequestResultSt atus
1 1 22/02/2004 BACKUP FAIL
2 1 22/02/2004 BACKUP FAIL
3 2 22/02/2004 BACKUP SUCCESS
4 2 27/02/2004 LIST SUCCESS
5 3 1/03/2004 BACKUP SUCCESS
6 3 1/03/2004 BACKUP SUCCESS
7 3 1/03/2004 BACKUP SUCCESS
8 3 1/03/2004 LIST SUCCESS
9 3 1/03/2004 LIST SUCCESS

Nov 13 '05 #1
5 1672
"Andy Davis" <ad******@westn et.com.au> wrote in message
news:41******@q uokka.wn.com.au ...
I have a two tables, Users and Requests, the latter which displays the daily log on's of 20 users. Both tables are related by a one-to-many relationship in the Requests table via the UserId field.

I want to run a query that when I enter a date shows all the users that DID NOT connect for that particular day. For example, say user id's 1 and 2
were on the system on a particular day but user id's 3 - 20 were not, how
do I display just the users that were not connected on that day. Using the
NOT LIKE ("DATE") shows all the remaining users not connected but obviously returns all the remaining dates as well. Unfortunately, the Requests table
does not show users that are not connected as a Null field. So I cannot use an Is Null criteria. A copy of some sample data from the Requests table is shown below. Thus, if "22/02/2004" is the date I want to view Users that
were not connected, based on the data below I know that UserId 3 and the
rest (which I have not shown as it would be a long list!) were not logged on that day. So how can I display just User Id's 3 to UserId(n). I have tried
using left joins but not having any success. Of the coding that has been
recommended it tends to just return all the UserId's instead of the ones
that are left.

Hope the above is makes the problem clearer. Many thanks and I hope someone can help!

RequestId UserId RequestDate RequestType RequestResultSt atus
1 1 22/02/2004 BACKUP FAIL
2 1 22/02/2004 BACKUP FAIL
3 2 22/02/2004 BACKUP SUCCESS
4 2 27/02/2004 LIST SUCCESS
5 3 1/03/2004 BACKUP SUCCESS
6 3 1/03/2004 BACKUP SUCCESS
7 3 1/03/2004 BACKUP SUCCESS
8 3 1/03/2004 LIST SUCCESS
9 3 1/03/2004 LIST SUCCESS


SELECT U.UserId FROM Users U LEFT JOIN Requests R ON (U.UserId = R.UserId
AND R.RequestDate = #02/22/2004#) WHERE R.RequestId IS NULL
Nov 13 '05 #2
Brian

Many thanks for the code which I've modified slightly as shown below to
allow the entry of any particular date. I'm currenly using MS Access 2003,
so because it's an SQL query how do I run it withiout showing the code as
currently happens when I open it in design view. Ultimately I want to
produce the results in a report, whereby a user will type in the date they
wish to see clients not connected via this query.
SELECT Users.UserId

FROM Users LEFT JOIN requests_new ON (Users.UserId = requests_new.Us erId

AND requests_new.da te = [ Enter Date] )

WHERE requests_new.Us erId IS NULL;

Thanks again

Dawn
"Brian" <bc**@IHATESPAM clara.co.uk> wrote in message
news:10******** ********@sabbat h.news.uk.clara .net...
"Andy Davis" <ad******@westn et.com.au> wrote in message
news:41******@q uokka.wn.com.au ...
I have a two tables, Users and Requests, the latter which displays the

daily
log on's of 20 users. Both tables are related by a one-to-many

relationship
in the Requests table via the UserId field.

I want to run a query that when I enter a date shows all the users that

DID
NOT connect for that particular day. For example, say user id's 1 and 2
were on the system on a particular day but user id's 3 - 20 were not,
how
do I display just the users that were not connected on that day. Using
the
NOT LIKE ("DATE") shows all the remaining users not connected but

obviously
returns all the remaining dates as well. Unfortunately, the Requests
table
does not show users that are not connected as a Null field. So I cannot

use
an Is Null criteria. A copy of some sample data from the Requests table

is
shown below. Thus, if "22/02/2004" is the date I want to view Users that
were not connected, based on the data below I know that UserId 3 and the
rest (which I have not shown as it would be a long list!) were not logged

on
that day. So how can I display just User Id's 3 to UserId(n). I have
tried
using left joins but not having any success. Of the coding that has been
recommended it tends to just return all the UserId's instead of the ones
that are left.

Hope the above is makes the problem clearer. Many thanks and I hope

someone
can help!

RequestId UserId RequestDate RequestType RequestResultSt atus
1 1 22/02/2004 BACKUP FAIL
2 1 22/02/2004 BACKUP FAIL
3 2 22/02/2004 BACKUP SUCCESS
4 2 27/02/2004 LIST SUCCESS
5 3 1/03/2004 BACKUP SUCCESS
6 3 1/03/2004 BACKUP SUCCESS
7 3 1/03/2004 BACKUP SUCCESS
8 3 1/03/2004 LIST SUCCESS
9 3 1/03/2004 LIST SUCCESS


SELECT U.UserId FROM Users U LEFT JOIN Requests R ON (U.UserId = R.UserId
AND R.RequestDate = #02/22/2004#) WHERE R.RequestId IS NULL

Nov 13 '05 #3
"Andy Davis" <ad******@westn et.com.au> wrote in message
news:41******** @quokka.wn.com. au...
Brian

Many thanks for the code which I've modified slightly as shown below to
allow the entry of any particular date. I'm currenly using MS Access 2003,
so because it's an SQL query how do I run it withiout showing the code as
currently happens when I open it in design view. Ultimately I want to
produce the results in a report, whereby a user will type in the date they
wish to see clients not connected via this query.
SELECT Users.UserId

FROM Users LEFT JOIN requests_new ON (Users.UserId = requests_new.Us erId

AND requests_new.da te = [ Enter Date] )

WHERE requests_new.Us erId IS NULL;

Thanks again

Dawn

Hi Dawn,

If you simply create a report with this query as it's recordsource (you may
be able to do this with the wizard, depending on what you want the report to
show/look like) then when you run the report Access will prompt for the
parameter [ Enter Date ]

There a several other ways you could handle this, but this is the simplest.

Brian
Nov 13 '05 #4
Brian

Thanks. I actually did that after I posted the message, so I was ok on that
one in the end. One last question. For the date that I enter as the search
criteria in the SQL code, is there any way I can then display that date
entered in the report. That way the user who prints the report can see the
date that clients not connected refers to. I apologise for my lack of
knowledge but I've only did a little SQL about 3 years ago and I'm afraid
I'm a little rusty, but I'm certainly enjoying getting back into it again.
Thanks in advance.

Dawn

"Brian" <bc**@IHATESPAM clara.co.uk> wrote in message
news:10******** ********@lotis. uk.clara.net...
"Andy Davis" <ad******@westn et.com.au> wrote in message
news:41******** @quokka.wn.com. au...
Brian

Many thanks for the code which I've modified slightly as shown below to
allow the entry of any particular date. I'm currenly using MS Access
2003,
so because it's an SQL query how do I run it withiout showing the code as
currently happens when I open it in design view. Ultimately I want to
produce the results in a report, whereby a user will type in the date
they
wish to see clients not connected via this query.
SELECT Users.UserId

FROM Users LEFT JOIN requests_new ON (Users.UserId = requests_new.Us erId

AND requests_new.da te = [ Enter Date] )

WHERE requests_new.Us erId IS NULL;

Thanks again

Dawn

Hi Dawn,

If you simply create a report with this query as it's recordsource (you
may
be able to do this with the wizard, depending on what you want the report
to
show/look like) then when you run the report Access will prompt for the
parameter [ Enter Date ]

There a several other ways you could handle this, but this is the
simplest.

Brian

Nov 13 '05 #5
"Andy Davis" <ad******@westn et.com.au> wrote in message
news:41******@q uokka.wn.com.au ...
Brian

Thanks. I actually did that after I posted the message, so I was ok on that one in the end. One last question. For the date that I enter as the search
criteria in the SQL code, is there any way I can then display that date
entered in the report. That way the user who prints the report can see the
date that clients not connected refers to. I apologise for my lack of
knowledge but I've only did a little SQL about 3 years ago and I'm afraid
I'm a little rusty, but I'm certainly enjoying getting back into it again.
Thanks in advance.

Dawn


Hi Dawn,

There's no need to apologise. If I remember rightly, your parameter was
called [ Enter Date ], or something like that. Add a text box to the report
header, and set it's control Source to:

="Report for date:" & [ Enter Date ]

Obviously you can modify the text to say whatever you like, but the
important bit is to include the name of the parameter as it is in the query.
Nov 13 '05 #6

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

Similar topics

0
1615
by: Giuseppe | last post by:
Hello.. I hope someone could help me here... I've installed a phpbb forum and the mod char pjirc. I'm using IRC server irc.blitzed.org and a custom channel. Is it possibile to read via php o js or in other way the list of users connected in some particular channel? This thing help me to show on the forum how many users are connected in the chat. Someone suggested me to use Thales... but is too complicated for me and then I ave a window...
4
47433
by: Ryan McMinn | last post by:
Is there a utility that will allow me to see what users on my network are connected/active on SQL server? Ryan
2
9983
by: MichaelB | last post by:
When I try logging into my web app using local host I am getting the "HTTP 403.9 - Access Forbidden: Too many users are connected Internet Information Services". The thing is I do not have 10 users connected! I have been running Microsoft Application Center Test for load testing purposes, and also another application called "ANTS Load" for the same purpose. I don't know if there's any direct relation between doing load testing with these...
9
1985
by: mikharakiri_nospaum | last post by:
I have graph x y - - 1 2 2 3 3 1 4 5 and would like to query how many connected components it has (two in the example -- {1,2,3} and {4,5}). Is it doable with "recursive with"?
2
2629
by: Sid S. | last post by:
Is there a way to programatically tell how many users are connected to IIS with c#? Or maybe some API? I don't want to restrict a certain amout of users, just restrict some features. Thanks in advance. Sid S.
0
1317
by: Betty Harvey | last post by:
The next meeting of the XML Users Group will be held on Wednesday, June 21, 2006 at the American Geophysical Union (AGU) at 2000 Florida Avenue, N.W., Washington, DC 20009-1277. The meeting starts at 7:00 p.m. and usually last approximately 2 hours. If attending the meeting by Metro, get off the Dupont Circle stop and walk north to Florida Avenue...turn right. There is no cost associated with attending but if you are planning on...
5
12267
by: alingsjtu | last post by:
Hello, every body. When execute dynamic generated multiple OPENQUERY statements (which linkes to DB2) in SQLServer, I always got SQL1040N The maximum number of applications is already connected to the database. SQLSTATE=57030. Background: I created a linked server to DB2 8.1 database which called GRR_DB2Server. In my stored procedure p_FetchRawData, I need to read some data from this linked server GRR_DB2Server and insert them into
1
1398
LMHelper
by: LMHelper | last post by:
Ok I am creating a new database for LM. One that will keep track of our licenses for over 400 users. We already have a database with the users information like name, location, telephone number, employee ID. In the licensing database so far I have created a table explaining the licensing information and gave each application a code so that each person will have that code listed in their table to reflect what software they have. I have a form...
1
3526
by: esource | last post by:
We have a existing backup, re-index job that runs at night on an existing database that is now accessed by web users 24/7. Problem is that one of the steps is to kill all users before backup starts so it kills any transactions that are happening at that time question is... Can users be connected during a backup? Will removing the kill users step slow the backup alot? any other suggestions would be appreciated. thanks
0
9698
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10914
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10597
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10656
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7834
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5684
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4495
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4071
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3136
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.