- CASE_ID BEFORE BETWEEN AFTER
-
53222 N N Y
-
53222 Y N N
-
53222 Y N N
-
53222 Y N N
-
53222 Y N N
-
53222 Y N N
-
53222 Y N N
-
54233 Y N N
-
54233 Y N N
-
54233 Y N N
-
54233 Y N N
-
54375 Y N N
-
54375 Y N N
-
54375 Y N N
-
54375 Y N N
-
54375 Y N N
-
54375 Y N N
-
54375 Y N N
-
54375 Y N N
-
54992 Y N N
-
54992 Y N N
-
54992 Y N N
-
54992 Y N N
-
54992 Y N N
-
54992 Y N N
-
54992 Y N N
Please help.
I have a query with the above data. I want to consolidate it and have a row for each distinct Case_ID based on the following condition,
BEFORE column = 'Y', if any of the rows for that Case_ID has a 'Y', else BEFORE column = 'N'
BETWEEN column = 'Y', if any of the rows for that Case_ID has a 'Y', else BEFORE column = 'N'
AFTER column = 'Y', if any of the rows for that Case_ID has a 'Y', else BEFORE column = 'N'.
So for Case_ID = 53222 abd 54233, the consolidated rows should look like,
53222, Y, N, Y
54233, Y, N, N
Thanks in advance
3 2449 NeoPa 32,568
Recognized Expert Moderator MVP
Try : - SELECT [Case_ID],
-
Max([Before]) AS [MaxBefore],
-
Max([Between]) AS [MaxBetween],
-
Max([After]) AS [MaxAfter]
-
FROM [Query]
-
GROUP BY [Case_ID]
BTW I'm assuming your post should have read :
BEFORE column = 'Y', if any of the rows for that Case_ID has a 'Y', else BEFORE column = 'N'
BETWEEN column = 'Y', if any of the rows for that Case_ID has a 'Y', else BETWEEN column = 'N'
AFTER column = 'Y', if any of the rows for that Case_ID has a 'Y', else AFTER column = 'N'.
It worked, thank you so much.
NeoPa 32,568
Recognized Expert Moderator MVP
No problem :)
Pleased to help.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Andrew Chanter |
last post by:
I have a table containing multiple records per key. eg:
1 | John Smith
1 | Mary Brown
1 | Julie Grey
2 | Danny Pink
2 | Jill White
I need to consolidate this into a single record for each key, eg.
|
by: Dalan |
last post by:
Trying to determine the best approach to use in consolating multiple
records in an Access 97 Db. The users submit updates in HTML format
generated from a query that are in turn imported into a master
database. There are 50+/- records each that are submitted by a
substantial number of users with each periodic update. The output does
include the user ID reference and the date prepared, but as a query
has no header, the information is...
|
by: deko |
last post by:
How can I consolidate these two tables into a single view?
Current:
=TableA=
fldP
fldX
=TableB=
fldY
|
by: Bob |
last post by:
I have been asked to modify an existing Access database so that it can
update a MySQL databse in head office from multiple MS Access databases in
branches. The idea is that when the HO database is available then any
changes made in branch will automatically update HO but when HO database is
not available then changes are 'batched' until it is available and then
update. (There is a Virtula Private Network involved in this). The update
is...
|
by: Raj |
last post by:
Hi All,
I have a method call GetStationListenUrl that exists as three
overloaded methods
1) public static string GetUrl( int strength, string
strengthNavigateUrl, zzz.StreamRow sra, string bandName)
2) public static string GetUrl( int strength, string
strengthNavigateUrl, xxx.StreamsRow sra, string bandName)
| |
by: Sasikala |
last post by:
Hi,
I have a view which selects these columns: employeenumber,ClientID,Billing code,amountBilled,InvoiceNumber from a number of other tables.
One Employee may have many billingAmounts.
My view right now has each row for every Amount Billed for each Employee.I want to have a query which has only one row for each employee with repeating cloumns if they have multiple billings.
If an employee A has one row in the view,i want my output in...
|
by: --CELKO-- |
last post by:
Can I get a little help? Given a very simple table of events, with
their durations, I want to consolidate time periods for an event that
(1) touch each other or (2) overlap each other.
CREATE TABLE Events
(event_id VARCHAR(25) NOT NULL,
start_date DATE NOT NULL,
end_date DATE NOT NULL,
CHECK (start_date <= end_date),
PRIMARY KEY (event_id, start_date, end_date));
|
by: =?Utf-8?B?UHVjY2E=?= |
last post by:
Hi, I'm using vs2005, .net 2 for windows application. I have 2 solutions
that I would like to consolidate into and have just one installation .msi for
them, is this possible? So I just just copy and move one of the solution's
project file into the other one and create additional setup file in it?
Thanks.
--
Thanks.
|
by: MahaCoder |
last post by:
Given the following table:
EMPL_ID | CO_ID | START | STOP
--------------------------------------------
12 U 01/06/1976 07/09/1980
12 U 03/18/1982 11/18/1988
12 U 03/23/1988 05/01/1992
12 U 01/25/1991 02/29/1996
12 U 03/16/2004 05/05/2004
12 U 05/06/2004 12/31/9999
|
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,...
|
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...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
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...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |