Hi,
Hoping someone can help.
I am trying to concatenate the ages of still living children divided into
male & female.
So, male 23, female 25, male 13, female 18 should look like this.
Female: 25, 18
Male: 23, 13
This is the query I have that has achieved this but in columns, not rows.
SELECT [Client Details].ClientID, Children.ChildI D, Children.FirstN ame,
Children.[Middle Name], Children.LastNa me, Children.Age, Children.ChildS ex,
Children.DateOf Birth, Children.[Still Living], IIf([Still Living]=True And
[ChildSex]="f",[Age],Null) AS Expr1, IIf([Still Living]=True And
[ChildSex]="m",[Age],Null) AS Expr2
FROM [Client Details] RIGHT JOIN Children ON [Client Details].ClientID =
Children.ChildI D;
Any or all advice gratefully recieved.
--
Sharknwfk 8 11135
Thanks to both. Will try these options.
--
Sharknwfk
"Douglas J. Steele" <NOSPAM_djsteel e@NOSPAM_canada .com> wrote in message
news:N5******** ************@ro gers.com... See whether the code in http://www.mvps.org/access/modules/mdl0004.htm or http://www.mvps.org/access/modules/mdl0008.htm at "The Access Web" helps.
-- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "Sharknwfk" <sh*******@co.n z.uk> wrote in message news:41******@c lear.net.nz... Hi,
Hoping someone can help.
I am trying to concatenate the ages of still living children divided
into male & female.
So, male 23, female 25, male 13, female 18 should look like this.
Female: 25, 18
Male: 23, 13
This is the query I have that has achieved this but in columns, not
rows. SELECT [Client Details].ClientID, Children.ChildI D, Children.FirstN ame, Children.[Middle Name], Children.LastNa me, Children.Age, Children.ChildS ex, Children.DateOf Birth, Children.[Still Living], IIf([Still Living]=True
And [ChildSex]="f",[Age],Null) AS Expr1, IIf([Still Living]=True And [ChildSex]="m",[Age],Null) AS Expr2 FROM [Client Details] RIGHT JOIN Children ON [Client Details].ClientID = Children.ChildI D;
Any or all advice gratefully recieved.
-- Sharknwfk
See whether the code in http://www.mvps.org/access/modules/mdl0004.htm or http://www.mvps.org/access/modules/mdl0008.htm at "The Access Web" helps.
--
Doug Steele, Microsoft Access MVP http://I.Am/DougSteele
(no e-mails, please!)
"Sharknwfk" <sh*******@co.n z.uk> wrote in message
news:41******@c lear.net.nz... Hi,
Hoping someone can help.
I am trying to concatenate the ages of still living children divided into male & female.
So, male 23, female 25, male 13, female 18 should look like this.
Female: 25, 18
Male: 23, 13
This is the query I have that has achieved this but in columns, not rows.
SELECT [Client Details].ClientID, Children.ChildI D, Children.FirstN ame, Children.[Middle Name], Children.LastNa me, Children.Age,
Children.ChildS ex, Children.DateOf Birth, Children.[Still Living], IIf([Still Living]=True And [ChildSex]="f",[Age],Null) AS Expr1, IIf([Still Living]=True And [ChildSex]="m",[Age],Null) AS Expr2 FROM [Client Details] RIGHT JOIN Children ON [Client Details].ClientID = Children.ChildI D;
Any or all advice gratefully recieved.
-- Sharknwfk
Thanks to both. Will try these options.
--
Sharknwfk
"Douglas J. Steele" <NOSPAM_djsteel e@NOSPAM_canada .com> wrote in message
news:N5******** ************@ro gers.com... See whether the code in http://www.mvps.org/access/modules/mdl0004.htm or http://www.mvps.org/access/modules/mdl0008.htm at "The Access Web" helps.
-- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "Sharknwfk" <sh*******@co.n z.uk> wrote in message news:41******@c lear.net.nz... Hi,
Hoping someone can help.
I am trying to concatenate the ages of still living children divided
into male & female.
So, male 23, female 25, male 13, female 18 should look like this.
Female: 25, 18
Male: 23, 13
This is the query I have that has achieved this but in columns, not
rows. SELECT [Client Details].ClientID, Children.ChildI D, Children.FirstN ame, Children.[Middle Name], Children.LastNa me, Children.Age, Children.ChildS ex, Children.DateOf Birth, Children.[Still Living], IIf([Still Living]=True
And [ChildSex]="f",[Age],Null) AS Expr1, IIf([Still Living]=True And [ChildSex]="m",[Age],Null) AS Expr2 FROM [Client Details] RIGHT JOIN Children ON [Client Details].ClientID = Children.ChildI D;
Any or all advice gratefully recieved.
-- Sharknwfk
"Chuck Grimsby" <c.*******@worl dnet.att.net.in valid> wrote in message
news:ub******** *************** *********@4ax.c om... Do a CrossTab query. The CrossTab Query Wizard will do all the work for you.
Due to my limited skills, I plumped for this option. I split it into 2
crosstabs, 1 male & 1 female and then recombined the crosstabs as a select
query. Voila.
SQL below:
Female:
TRANSFORM First([Children Query].Age) AS FirstOfAge
SELECT [Children Query].ClientID
FROM [Children Query]
GROUP BY [Children Query].ClientID
PIVOT [Children Query].Expr1 In
(1,2,3,4,5,6,7, 8,9,10,11,12,13 ,14,15,16,17,18 ,19,20,21,22,23 ,24,25,26,27,28 ,
29,30,31,32,33, 34,35,36,37,38, 39,40,41,42,43, 44,45,46,47,48, 49,50,51,52,53, 5
4,55,56,57,58,5 9,60,61,62,63,6 4,65,66,67,68,6 9,70,71,72,73,7 4,75,76,77,78,7 9
,80,81,82,83,84 ,85,86,87,88,89 ,90,91,92,93,94 ,95,96,97,98,99 ,100);
Male:
TRANSFORM First([Children Query].Age) AS FirstOfAge
SELECT [Children Query].ClientID
FROM [Children Query]
GROUP BY [Children Query].ClientID
PIVOT [Children Query].Expr2 In
(1,2,3,4,5,6,7, 8,9,10,11,12,13 ,14,15,16,17,18 ,19,20,21,22,23 ,24,25,26,27,28 ,
29,30,31,32,33, 34,35,36,37,38, 39,40,41,42,43, 44,45,46,47,48, 49,50,51,52,53, 5
4,55,56,57,58,5 9,60,61,62,63,6 4,65,66,67,68,6 9,70,71,72,73,7 4,75,76,77,78,7 9
,80,81,82,83,84 ,85,86,87,88,89 ,90,91,92,93,94 ,95,96,97,98,99 ,100);
Combine two into select query:
SELECT [Female Issue].ClientID, [Female Issue].[Female Issue], [Male
Issue].[Male Issue]
FROM [Female Issue] INNER JOIN [Male Issue] ON [Female Issue].ClientID =
[Male Issue].ClientID;
The numbers 1 - 100 are put into Expr1 & 2's properties in the crosstabs as
column headings.
You never know, surviving kids could reach 100 in the future!
The reason I posted the code is I hate it when someone posts a possible
solution and then you never hear whether it was successful or how they
finally achieved it.
Cheers,
--
Sharknwfk
"Chuck Grimsby" <c.*******@worl dnet.att.net.in valid> wrote in message
news:ub******** *************** *********@4ax.c om... Do a CrossTab query. The CrossTab Query Wizard will do all the work for you.
Due to my limited skills, I plumped for this option. I split it into 2
crosstabs, 1 male & 1 female and then recombined the crosstabs as a select
query. Voila.
SQL below:
Female:
TRANSFORM First([Children Query].Age) AS FirstOfAge
SELECT [Children Query].ClientID
FROM [Children Query]
GROUP BY [Children Query].ClientID
PIVOT [Children Query].Expr1 In
(1,2,3,4,5,6,7, 8,9,10,11,12,13 ,14,15,16,17,18 ,19,20,21,22,23 ,24,25,26,27,28 ,
29,30,31,32,33, 34,35,36,37,38, 39,40,41,42,43, 44,45,46,47,48, 49,50,51,52,53, 5
4,55,56,57,58,5 9,60,61,62,63,6 4,65,66,67,68,6 9,70,71,72,73,7 4,75,76,77,78,7 9
,80,81,82,83,84 ,85,86,87,88,89 ,90,91,92,93,94 ,95,96,97,98,99 ,100);
Male:
TRANSFORM First([Children Query].Age) AS FirstOfAge
SELECT [Children Query].ClientID
FROM [Children Query]
GROUP BY [Children Query].ClientID
PIVOT [Children Query].Expr2 In
(1,2,3,4,5,6,7, 8,9,10,11,12,13 ,14,15,16,17,18 ,19,20,21,22,23 ,24,25,26,27,28 ,
29,30,31,32,33, 34,35,36,37,38, 39,40,41,42,43, 44,45,46,47,48, 49,50,51,52,53, 5
4,55,56,57,58,5 9,60,61,62,63,6 4,65,66,67,68,6 9,70,71,72,73,7 4,75,76,77,78,7 9
,80,81,82,83,84 ,85,86,87,88,89 ,90,91,92,93,94 ,95,96,97,98,99 ,100);
Combine two into select query:
SELECT [Female Issue].ClientID, [Female Issue].[Female Issue], [Male
Issue].[Male Issue]
FROM [Female Issue] INNER JOIN [Male Issue] ON [Female Issue].ClientID =
[Male Issue].ClientID;
The numbers 1 - 100 are put into Expr1 & 2's properties in the crosstabs as
column headings.
You never know, surviving kids could reach 100 in the future!
The reason I posted the code is I hate it when someone posts a possible
solution and then you never hear whether it was successful or how they
finally achieved it.
Cheers,
--
Sharknwfk
"Chuck Grimsby" <c.*******@worl dnet.att.net.in valid> wrote in message
news:aq******** *************** *********@4ax.c om... On Sun, 12 Dec 2004 14:16:57 +1300, "Sharknwfk" <sh*******@co.n z.uk> wrote:"Chuck Grimsby" <c.*******@worl dnet.att.net.in valid> wrote in message news:ub******* *************** **********@4ax. com... Do a CrossTab query. The CrossTab Query Wizard will do all the work for you.Due to my limited skills, I plumped for this option. I split it into 2 crosstabs, 1 male & 1 female and then recombined the crosstabs as a
selectquery. Voila.
Congratulations ! And thanks for letting us know it worked, and how you did it.
Oops, spoke too soon. Too many fields defined. I'll get there and then post
back.
--
Sharknwfk
"Chuck Grimsby" <c.*******@worl dnet.att.net.in valid> wrote in message
news:aq******** *************** *********@4ax.c om... On Sun, 12 Dec 2004 14:16:57 +1300, "Sharknwfk" <sh*******@co.n z.uk> wrote:"Chuck Grimsby" <c.*******@worl dnet.att.net.in valid> wrote in message news:ub******* *************** **********@4ax. com... Do a CrossTab query. The CrossTab Query Wizard will do all the work for you.Due to my limited skills, I plumped for this option. I split it into 2 crosstabs, 1 male & 1 female and then recombined the crosstabs as a
selectquery. Voila.
Congratulations ! And thanks for letting us know it worked, and how you did it.
Oops, spoke too soon. Too many fields defined. I'll get there and then post
back.
--
Sharknwfk
"Sharknwfk" <sh*******@co.n z.uk> wrote in message
news:41******@c lear.net.nz... "Chuck Grimsby" <c.*******@worl dnet.att.net.in valid> wrote in message news:aq******** *************** *********@4ax.c om... On Sun, 12 Dec 2004 14:16:57 +1300, "Sharknwfk" <sh*******@co.n z.uk> wrote:"Chuck Grimsby" <c.*******@worl dnet.att.net.in valid> wrote in message news:ub******* *************** **********@4ax. com... > Do a CrossTab query. The CrossTab Query Wizard will do all the work > for you.Due to my limited skills, I plumped for this option. I split it into 2 crosstabs, 1 male & 1 female and then recombined the crosstabs as a selectquery. Voila.
Congratulations ! And thanks for letting us know it worked, and how you did it.
Oops, spoke too soon. Too many fields defined. I'll get there and then
post back.
Okay, here's how it works.
2 Crosstabs
Female:
TRANSFORM First([Children Query].Age) AS FirstOfAge
SELECT [Children Query].ClientID
FROM [Children Query]
GROUP BY [Children Query].ClientID
PIVOT [Children Query].Expr1 In
(1,2,3,4,5,6,7, 8,9,10,11,12,13 ,14,15,16,17,18 ,19,20,21,22,23 ,24,25,26,27,28 ,
29,30,31,32,33, 34,35,36,37,38, 39,40,41,42,43, 44,45,46,47,48, 49,50,51,52,53, 5
4,55,56,57,58,5 9,60,61,62,63,6 4,65,66,67,68,6 9,70,71,72,73,7 4,75,76,77,78,7 9
,80,81,82,83,84 ,85,86,87,88,89 ,90,91,92,93,94 ,95,96,97,98,99 ,100);
The numbers 1 -100 go in the properties section of the column headings
Male:
TRANSFORM First([Children Query].Age) AS FirstOfAge
SELECT [Children Query].ClientID
FROM [Children Query]
GROUP BY [Children Query].ClientID
PIVOT [Children Query].Expr2 In
(1,2,3,4,5,6,7, 8,9,10,11,12,13 ,14,15,16,17,18 ,19,20,21,22,23 ,24,25,26,27,28 ,
29,30,31,32,33, 34,35,36,37,38, 39,40,41,42,43, 44,45,46,47,48, 49,50,51,52,53, 5
4,55,56,57,58,5 9,60,61,62,63,6 4,65,66,67,68,6 9,70,71,72,73,7 4,75,76,77,78,7 9
,80,81,82,83,84 ,85,86,87,88,89 ,90,91,92,93,94 ,95,96,97,98,99 ,100);
2 Select queries:
Male:
SELECT [Children Query_Crosstab Male].ClientID, [1] & " " & [2] & " " & [3]
& " " & [4] & " " & [5] & " " & [6] & " " & [7] & " " & [8] & " " & [9] & "
" & [10] & " " & [11] & " " & [12] & " " & [13] & " " & [14] & " " & [15] &
" " & [16] & " " & [17] & " " & [18] & " " & [19] & " " & [20] & " " & [21]
& " " & [22] & " " & [23] & " " & [24] & " " & [25] & " " & [26] & " " &
[27] & " " & [28] & " " & [29] & " " & [30] AS [Male Issue], [31] & " " &
[32] & " " & [33] & " " & [34] & " " & [35] & " " & [36] & " " & [37] & " "
& [38] & " " & [39] & " " & [40] & " " & [41] & " " & [42] & " " & [43] & "
" & [44] & " " & [45] & " " & [46] & " " & [47] & " " & [48] & " " & [49] &
" " & [50] & " " & [51] & " " & [52] & " " & [53] & " " & [54] & " " & [55]
& " " & [56] & " " & [57] & " " & [58] & " " & [59] & " " & [60] AS
MaleIssue2, [61] & " " & [62] & " " & [63] & " " & [64] & " " & [65] & " " &
[66] & " " & [67] & " " & [68] & " " & [69] & " " & [70] & " " & [71] & " "
& [72] & " " & [73] & " " & [74] & " " & [75] & " " & [76] & " " & [77] & "
" & [78] & " " & [79] & " " & [80] & " " & [81] & " " & [82] & " " & [83] &
" " & [84] & " " & [85] & " " & [86] & " " & [87] & " " & [88] & " " & [89]
& " " & [90] AS MaleIssue3
FROM [Children Query_Crosstab Male];
Female:
SELECT [Children Query_Crosstab Female].ClientID, [1] & " " & [2] & " " &
[3] & " " & [4] & " " & [5] & " " & [6] & " " & [7] & " " & [8] & " " & [9]
& " " & [10] & " " & [11] & " " & [12] & " " & [13] & " " & [14] & " " &
[15] & " " & [16] & " " & [17] & " " & [18] & " " & [19] & " " & [20] & " "
& [21] & " " & [22] & " " & [23] & " " & [24] & " " & [25] & " " & [26] & "
" & [27] & " " & [28] & " " & [29] & " " & [30] AS [Female Issue], [31] & "
" & [32] & " " & [33] & " " & [34] & " " & [35] & " " & [36] & " " & [37] &
" " & [38] & " " & [39] & " " & [40] & " " & [41] & " " & [42] & " " & [43]
& " " & [44] & " " & [45] & " " & [46] & " " & [47] & " " & [48] & " " &
[49] & " " & [50] & " " & [51] & " " & [52] & " " & [53] & " " & [54] & " "
& [55] & " " & [56] & " " & [57] & " " & [58] & " " & [59] & " " & [60] AS
FemaleIssue2, [61] & " " & [62] & " " & [63] & " " & [64] & " " & [65] & " "
& [66] & " " & [67] & " " & [68] & " " & [69] & " " & [70] & " " & [71] & "
" & [72] & " " & [73] & " " & [74] & " " & [75] & " " & [76] & " " & [77] &
" " & [78] & " " & [79] & " " & [80] & " " & [81] & " " & [82] & " " & [83]
& " " & [84] & " " & [85] & " " & [86] & " " & [87] & " " & [88] & " " &
[89] & " " & [90] AS FemaleIssue3
FROM [Children Query_Crosstab Female];
Then used DLookup in the control source of two text boxes:
Female:
=DLookUp("[Female Issue]+[FemaleIssue2]+[FemaleIssue3]","Female
Issue","[ClientID] =" & Forms![Notification of Death for
Registration]!ClientID)
Male:
=DLookUp("[Male Issue]+[MaleIssue2]+[MaleIssue3]","Male Issue","[ClientID]
=" & Forms![Notification of Death for Registration]!ClientID)
I hope this saves someone the hair pulling I went through!
Cheers,
--
Sharknwfk This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Nick Heppleston |
last post by:
I have a concatenation problem and I was wondering if somebody might be
able to offer some help :-)
I have the following table structure holding product long descriptions:
Part No (pn) Sequence (seq) Long Description (long_desc)
--------------- --------------- ----------------------------------------
HL1450 10 This is part of a long description and
HL1450 20 it overlaps onto several lines. I'm
HL1450 30 having difficulty writing...
|
by: pb648174 |
last post by:
I have a single update statement that updates the same column multiple
times in the same update statement. Basically i have a column that
looks like .1.2.3.4. which are id references that need to be updated
when a group of items is copied. I can successfully do this with
cursors, but am experimenting with a way to do it with a single update
statement.
I have verified that each row being returned to the Update statement
(in an...
|
by: christopher.secord |
last post by:
Is there any advantage to doing this:
ALTER TABLE testtable ADD
CONSTRAINT PK_sysUser
PRIMARY KEY NONCLUSTERED (UserID)
WITH FILLFACTOR = 100,
CONSTRAINT IX_sysUser
UNIQUE NONCLUSTERED (UserID)
WITH FILLFACTOR = 100
|
by: Krish |
last post by:
I have created 2 tables, both tables have the same column names (property
ColumnName) it is priceDate,priceTime and priceValue
I get an error saying that Column priceDate already belongs to another datatable .
Is it correct that the 2 tables cannot have the same column names.
I am trying to create a data relation to get the common dates.
|
by: Marina |
last post by:
Hi,
Let's say I bind the same column to multiple properties of one control (or
even to the same property of several controls).
If a user changes the value of the property in one control - I would like to
take that value, and put it in the data source, and have anything else bound
to this column get updated with the new value.
However, called EndCurrentEdit, resets the value to the original, and
| |
by: Asfar |
last post by:
I have a databound column in DataGridView.
Is there a way to have different cell types in the same column?
Thanks,
-Asfar
|
by: Volition |
last post by:
I have looked around and can't find any help for my SQL problem.
I have a Table which lists people
peopledb.
_____________
id | Name
1 | Fred
2 | Bill
3 | Bob
|
by: stevepl7 |
last post by:
I want to make the rows become column headings in an Access table or query. The data changes based on input to a form. It looks like this:
A B
N1 1
N2 2
N3 3
N4 4
Where A and B are the column headings.
|
by: pl1 |
last post by:
Hi everyone,
I'm using MS-Access 2003, OS: Window XP Professional sp3.
In Northwind database (sample Database),the Suppliers table have column "SupplierID" which is also present in Products table, my question is how can I use same column in 2 tables without entering data in them manually
Also the relationship between 'Suppliers' table and 'Products' table is one-to-many. The column type in Products table for column "SuppliersID" is...
|
by: perhapscwk |
last post by:
vba, how to use vba to search how many distinct amount in same column?
for example..
column C have amount
123
123
444
123
445
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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: 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...
|
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: 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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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.
| |