A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

2 criteria for query



 
 
Thread Tools Display Modes
  #1  
Old December 10th, 2009, 05:11 PM posted to microsoft.public.access.queries
NeedExcelHelp07
external usenet poster
 
Posts: 45
Default 2 criteria for query

How would I write a query where I want to find a conflict of user profiles
sorted by id's? I have a table listing user id's, names, and profiles. I want
to find users with conflicts. For example if a user has profile 2001 or 2002,
then they can not have profiles 2012, 2014, 2015.

Thanks


  #2  
Old December 10th, 2009, 06:08 PM posted to microsoft.public.access.queries
Stefan Hoffmann
external usenet poster
 
Posts: 991
Default 2 criteria for query

hi,

hmm, Excel or Access?

On 10.12.2009 18:11, NeedExcelHelp07 wrote:
How would I write a query where I want to find a conflict of user profiles
sorted by id's? I have a table listing user id's, names, and profiles. I want
to find users with conflicts. For example if a user has profile 2001 or 2002,
then they can not have profiles 2012, 2014, 2015.

Where is the conflict?

May a user only have zero, one or two profiles or is this number a year
and the user may not have profiles in the future?

The basic approach is to group by the user, and filter by HAVING
Count(*) 1, e.g.

SELECT [UserId], Count(*)
FROM [yourTable]
WHERE [Profile] Year(Now)
GROUP BY [UserID]
HAVING Count(*) 1


mfG
-- stefan --
  #3  
Old December 10th, 2009, 06:51 PM posted to microsoft.public.access.queries
NeedExcelHelp07
external usenet poster
 
Posts: 45
Default 2 criteria for query

Thanks for the help.
I think Access because of the large number of data.
It is a four digit number assigned for access to a system.
A user can have between 1-30 different profiles.

Thanks!

"Stefan Hoffmann" wrote:

hi,

hmm, Excel or Access?

On 10.12.2009 18:11, NeedExcelHelp07 wrote:
How would I write a query where I want to find a conflict of user profiles
sorted by id's? I have a table listing user id's, names, and profiles. I want
to find users with conflicts. For example if a user has profile 2001 or 2002,
then they can not have profiles 2012, 2014, 2015.

Where is the conflict?

May a user only have zero, one or two profiles or is this number a year
and the user may not have profiles in the future?

The basic approach is to group by the user, and filter by HAVING
Count(*) 1, e.g.

SELECT [UserId], Count(*)
FROM [yourTable]
WHERE [Profile] Year(Now)
GROUP BY [UserID]
HAVING Count(*) 1


mfG
-- stefan --
.

  #4  
Old December 10th, 2009, 07:04 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default 2 criteria for query

I think you will need to build a 'Conflict' or 'Conpatible' table, whichever
is easiest for you.
Assigned Conflict
2001 2012
2001 2033
2001 2014
2001 2015
2002 2012
2002 2033
2002 2014
2002 2015

--
Build a little, test a little.


"NeedExcelHelp07" wrote:

Thanks for the help.
I think Access because of the large number of data.
It is a four digit number assigned for access to a system.
A user can have between 1-30 different profiles.

Thanks!

"Stefan Hoffmann" wrote:

hi,

hmm, Excel or Access?

On 10.12.2009 18:11, NeedExcelHelp07 wrote:
How would I write a query where I want to find a conflict of user profiles
sorted by id's? I have a table listing user id's, names, and profiles. I want
to find users with conflicts. For example if a user has profile 2001 or 2002,
then they can not have profiles 2012, 2014, 2015.

Where is the conflict?

May a user only have zero, one or two profiles or is this number a year
and the user may not have profiles in the future?

The basic approach is to group by the user, and filter by HAVING
Count(*) 1, e.g.

SELECT [UserId], Count(*)
FROM [yourTable]
WHERE [Profile] Year(Now)
GROUP BY [UserID]
HAVING Count(*) 1


mfG
-- stefan --
.

  #5  
Old December 10th, 2009, 07:19 PM posted to microsoft.public.access.queries
NeedExcelHelp07
external usenet poster
 
Posts: 45
Default 2 criteria for query

How would I create a conflict table?

"KARL DEWEY" wrote:

I think you will need to build a 'Conflict' or 'Conpatible' table, whichever
is easiest for you.
Assigned Conflict
2001 2012
2001 2033
2001 2014
2001 2015
2002 2012
2002 2033
2002 2014
2002 2015

--
Build a little, test a little.


"NeedExcelHelp07" wrote:

Thanks for the help.
I think Access because of the large number of data.
It is a four digit number assigned for access to a system.
A user can have between 1-30 different profiles.

Thanks!

"Stefan Hoffmann" wrote:

hi,

hmm, Excel or Access?

On 10.12.2009 18:11, NeedExcelHelp07 wrote:
How would I write a query where I want to find a conflict of user profiles
sorted by id's? I have a table listing user id's, names, and profiles. I want
to find users with conflicts. For example if a user has profile 2001 or 2002,
then they can not have profiles 2012, 2014, 2015.
Where is the conflict?

May a user only have zero, one or two profiles or is this number a year
and the user may not have profiles in the future?

The basic approach is to group by the user, and filter by HAVING
Count(*) 1, e.g.

SELECT [UserId], Count(*)
FROM [yourTable]
WHERE [Profile] Year(Now)
GROUP BY [UserID]
HAVING Count(*) 1


mfG
-- stefan --
.

  #6  
Old December 10th, 2009, 07:42 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default 2 criteria for query

My last post include an example of such table.
I can not tell you how to apply in a query without knowing your table
structure, table name, fields with datatype, and sample data.

--
Build a little, test a little.


"NeedExcelHelp07" wrote:

How would I create a conflict table?

"KARL DEWEY" wrote:

I think you will need to build a 'Conflict' or 'Conpatible' table, whichever
is easiest for you.
Assigned Conflict
2001 2012
2001 2033
2001 2014
2001 2015
2002 2012
2002 2033
2002 2014
2002 2015

--
Build a little, test a little.


"NeedExcelHelp07" wrote:

Thanks for the help.
I think Access because of the large number of data.
It is a four digit number assigned for access to a system.
A user can have between 1-30 different profiles.

Thanks!

"Stefan Hoffmann" wrote:

hi,

hmm, Excel or Access?

On 10.12.2009 18:11, NeedExcelHelp07 wrote:
How would I write a query where I want to find a conflict of user profiles
sorted by id's? I have a table listing user id's, names, and profiles. I want
to find users with conflicts. For example if a user has profile 2001 or 2002,
then they can not have profiles 2012, 2014, 2015.
Where is the conflict?

May a user only have zero, one or two profiles or is this number a year
and the user may not have profiles in the future?

The basic approach is to group by the user, and filter by HAVING
Count(*) 1, e.g.

SELECT [UserId], Count(*)
FROM [yourTable]
WHERE [Profile] Year(Now)
GROUP BY [UserID]
HAVING Count(*) 1


mfG
-- stefan --
.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:55 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.