A
Alp Bekisoglu
Hi,
Having a hard time coming up with (field names are simplified for ease of
reference):
1999 1 xxxxxxx & yyyyyyy 362 R
as a result from querying a table data which has entries like:
ya pid p_no days
1999 1 xxxxxxx 150
1999 1 xxxxxxx 62
1999 1 yyyyyyy 120
1999 1 yyyyyyy 30
R is a calculated value with respect to the total of "days"
ya, pid & days are numeric
p_no is text
There can be more than one p_no's in a year and that's where I'm stuck at
the moment. The actual SQL is:
SELECT gunler.YA, gunler.KISI_ID, gunler.Pasaport_no, cp4_a.citizenship,
Sum(gunler.DaysInMY) AS SumOfDaysInMY,
IIf(Left([citizenship],5)="Malay","Resident",IIf([SumOfDaysInMY]>=182,"Resid
ent","Non-Resident")) AS stat, cp4_a.y_a, Count(gunler.Pasaport_no) AS
CountOfPasaport_no
FROM gunler, cp4_a
GROUP BY gunler.YA, gunler.KISI_ID, gunler.Pasaport_no, cp4_a.citizenship,
cp4_a.y_a
which gives me 2 lines of result with respect to the two different p_no
values. The R also changes according to this which should not be the case
since it should depend on the total of "days" regardless of the "p_no" as
long as the "ya" is same and "pid" is same respectively.
Any help is much appreciated.
TIA
Alp
Having a hard time coming up with (field names are simplified for ease of
reference):
1999 1 xxxxxxx & yyyyyyy 362 R
as a result from querying a table data which has entries like:
ya pid p_no days
1999 1 xxxxxxx 150
1999 1 xxxxxxx 62
1999 1 yyyyyyy 120
1999 1 yyyyyyy 30
R is a calculated value with respect to the total of "days"
ya, pid & days are numeric
p_no is text
There can be more than one p_no's in a year and that's where I'm stuck at
the moment. The actual SQL is:
SELECT gunler.YA, gunler.KISI_ID, gunler.Pasaport_no, cp4_a.citizenship,
Sum(gunler.DaysInMY) AS SumOfDaysInMY,
IIf(Left([citizenship],5)="Malay","Resident",IIf([SumOfDaysInMY]>=182,"Resid
ent","Non-Resident")) AS stat, cp4_a.y_a, Count(gunler.Pasaport_no) AS
CountOfPasaport_no
FROM gunler, cp4_a
GROUP BY gunler.YA, gunler.KISI_ID, gunler.Pasaport_no, cp4_a.citizenship,
cp4_a.y_a
which gives me 2 lines of result with respect to the two different p_no
values. The R also changes according to this which should not be the case
since it should depend on the total of "days" regardless of the "p_no" as
long as the "ya" is same and "pid" is same respectively.
Any help is much appreciated.
TIA
Alp