Grouping of data
Hi all,
How can I get the grp_id for unique combination of manager and department, grp_id should be created on asc order of manager_id.
In this example manager_id 100 is minimum, so it should be grp 1 and all the employees with that manager_id should be in grp_id 1,
for manager_id 114 grp_id should be 2.
If, there is manager_id 117, it should create grp_id 3.
To get grp_num ,I can use row_number() over (partition by department_id,manager_id order by employee_id) grp_num
I am looking for an update statement for this issue.
Oracle version : Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
CREATE TABLE HR.EMPLOYEES_2
EMPLOYEE_ID NUMBER(6),
FIRST_NAME VARCHAR2(20 BYTE),
LAST_NAME VARCHAR2(25 BYTE),
EMAIL VARCHAR2(25 BYTE),
PHONE_NUMBER VARCHAR2(20 BYTE),
HIRE_DATE DATE,
SALARY NUMBER(8,2),
MANAGER_ID NUMBER(6),
DEPARTMENT_ID NUMBER(4),
EMPLOYEE_CHILD_ID NUMBER,
JOB_NAME VARCHAR2(100 BYTE),
COMMISSION NUMBER,
EMPLOYEE_MASTER_ID NUMBER,
GRP_NUM NUMBER,
GRP_ID NUMBER
Insert into EMPLOYEES_2
(EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, SALARY, MANAGER_ID, DEPARTMENT_ID, EMPLOYEE_CHILD_ID, JOB_NAME, COMMISSION, EMPLOYEE_MASTER_ID)
Values
(114, 'Den', 'Raphaely', 'DRAPHEAL', '515.127.4561', TO_DATE('12/07/1994 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 11000, 100, 30, 1087, 'PU_MAN', 0, 1207);
Insert into EMPLOYEES_2
(EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, SALARY, MANAGER_ID, DEPARTMENT_ID, EMPLOYEE_CHILD_ID, JOB_NAME, COMMISSION, EMPLOYEE_MASTER_ID)
Values
(115, 'Alexander', 'Khoo', 'AKHOO', '515.127.4562', TO_DATE('05/18/1995 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 3100, 100, 30, 1088, 'PU_CLERK', 0, 1208);
Insert into EMPLOYEES_2
(EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, SALARY, MANAGER_ID, DEPARTMENT_ID, EMPLOYEE_CHILD_ID, JOB_NAME, COMMISSION, EMPLOYEE_MASTER_ID)
Values
(116, 'Shelli', 'Baida', 'SBAIDA', '515.127.4563', TO_DATE('12/24/1997 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2900, 114, 30, 1089, 'PU_CLERK', 0, 1209);
Insert into EMPLOYEES_2
(EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, SALARY, MANAGER_ID, DEPARTMENT_ID, EMPLOYEE_CHILD_ID, JOB_NAME, COMMISSION, EMPLOYEE_MASTER_ID)
Values
(117, 'Sigal', 'Tobias', 'STOBIAS', '515.127.4564', TO_DATE('07/24/1997 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2800, 114, 30, 1090, 'PU_CLERK', 0, 1210);
Insert into EMPLOYEES_2
(EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, SALARY, MANAGER_ID, DEPARTMENT_ID, EMPLOYEE_CHILD_ID, JOB_NAME, COMMISSION, EMPLOYEE_MASTER_ID)
Values
(118, 'Guy', 'Himuro', 'GHIMURO', '515.127.4565', TO_DATE('11/15/1998 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2600, 114, 30, 1091, 'PU_CLERK', 0, 1211);
Insert into EMPLOYEES_2
(EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, SALARY, MANAGER_ID, DEPARTMENT_ID, EMPLOYEE_CHILD_ID, JOB_NAME, COMMISSION, EMPLOYEE_MASTER_ID)
Values
(119, 'Karen', 'Colmenares', 'KCOLMENA', '515.127.4566', TO_DATE('08/10/1999 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2500, 114, 30, 1092, 'PU_CLERK', 0, 1212);
commit;
Expected result
EMPLOYEE_ID SALARY MANAGER_ID DEPARTMENT_ID GRP_NUM GRP_ID
114 11000 100 30 1 1
115 3100 100 30 2 1
116 2900 114 30 1 2
117 2800 114 30 2 2
118 2600 114 30 3 2
119 2500 114 30 4 2Edited by: Raghu on 10 Feb, 2013 12:59 PM
Hi Jeneesh,
Thanks for your response.
I should have given my requirement completely earlier.
From employees_2, data has to be copied to employee_2_target, employees_2_target have two extra columns GRP_ID and GRP_NUM.
Logic to populate GRP_ID and GRP_NUM are same as in my earlier post.
Every time employees_2 data gets truncated, next time when employees_2 gets new data,
it should be copied to target table and GRP_ID and GRP_NUM has to be populated again with the same logic.
For example, in the 2nd load if there is a combination of manager_id and department_id, grp_num should be incremented and grp_id should remain same.
CREATE TABLE HR.EMPLOYEES_2_TARGET
EMPLOYEE_ID NUMBER(6),
FIRST_NAME VARCHAR2(20 BYTE),
LAST_NAME VARCHAR2(25 BYTE),
EMAIL VARCHAR2(25 BYTE),
PHONE_NUMBER VARCHAR2(20 BYTE),
HIRE_DATE DATE,
SALARY NUMBER(8,2),
MANAGER_ID NUMBER(6),
DEPARTMENT_ID NUMBER(4),
EMPLOYEE_CHILD_ID NUMBER,
JOB_NAME VARCHAR2(100 BYTE),
COMMISSION NUMBER,
EMPLOYEE_MASTER_ID NUMBER,
GRP_ID NUMBER,
GRP_NUM NUMBER
1st set of data
Insert into EMPLOYEES_2
(EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, SALARY, MANAGER_ID, DEPARTMENT_ID, EMPLOYEE_CHILD_ID, JOB_NAME, COMMISSION, EMPLOYEE_MASTER_ID)
Values
(114, 'Den', 'Raphaely', 'DRAPHEAL', '515.127.4561', TO_DATE('12/07/1994 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 11000, 100, 30, 1087, 'PU_MAN', 0, 1207);
Insert into EMPLOYEES_2
(EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, SALARY, MANAGER_ID, DEPARTMENT_ID, EMPLOYEE_CHILD_ID, JOB_NAME, COMMISSION, EMPLOYEE_MASTER_ID)
Values
(115, 'Alexander', 'Khoo', 'AKHOO', '515.127.4562', TO_DATE('05/18/1995 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 3100, 100, 30, 1088, 'PU_CLERK', 0, 1208);
Insert into EMPLOYEES_2
(EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, SALARY, MANAGER_ID, DEPARTMENT_ID, EMPLOYEE_CHILD_ID, JOB_NAME, COMMISSION, EMPLOYEE_MASTER_ID)
Values
(116, 'Shelli', 'Baida', 'SBAIDA', '515.127.4563', TO_DATE('12/24/1997 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2900, 114, 30, 1089, 'PU_CLERK', 0, 1209);
Insert into EMPLOYEES_2
(EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, SALARY, MANAGER_ID, DEPARTMENT_ID, EMPLOYEE_CHILD_ID, JOB_NAME, COMMISSION, EMPLOYEE_MASTER_ID)
Values
(117, 'Sigal', 'Tobias', 'STOBIAS', '515.127.4564', TO_DATE('07/24/1997 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2800, 114, 30, 1090, 'PU_CLERK', 0, 1210);
Insert into EMPLOYEES_2
(EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, SALARY, MANAGER_ID, DEPARTMENT_ID, EMPLOYEE_CHILD_ID, JOB_NAME, COMMISSION, EMPLOYEE_MASTER_ID)
Values
(118, 'Guy', 'Himuro', 'GHIMURO', '515.127.4565', TO_DATE('11/15/1998 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2600, 114, 30, 1091, 'PU_CLERK', 0, 1211);
Insert into EMPLOYEES_2
(EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, SALARY, MANAGER_ID, DEPARTMENT_ID, EMPLOYEE_CHILD_ID, JOB_NAME, COMMISSION, EMPLOYEE_MASTER_ID)
Values
(119, 'Karen', 'Colmenares', 'KCOLMENA', '515.127.4566', TO_DATE('08/10/1999 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 2500, 114, 30, 1092, 'PU_CLERK', 0, 1212);
2nd set of data (table will be truncated for every set of data)
Insert into employees_2
(EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, JOB_ID, SALARY, MANAGER_ID, DEPARTMENT_ID)
Values
(400, 'Dan', 'Raphaely', 'DRAPHEAL', '515.127.4561', TO_DATE('12/05/1998 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'PU_MAN', 18000, 100, 30);
Insert into employees_2
(EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, JOB_ID, SALARY, MANAGER_ID, DEPARTMENT_ID)
Values
(401, 'Khoo', 'Alexander', 'AKHOO', '515.127.4562', TO_DATE('05/18/2005 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'PU_CLERK', 8100, 100, 30);
Insert into employees_2
(EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, JOB_ID, SALARY, MANAGER_ID, DEPARTMENT_ID)
Values
(512, 'Sigal', 'Tobias', 'STOBIAS', '515.127.4564', TO_DATE('07/24/1999 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'PU_CLERK', 8200, 114, 30);
Insert into employees_2
(EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, JOB_ID, SALARY, MANAGER_ID, DEPARTMENT_ID)
Values
(513, 'Karen', 'Colmenares', 'KCOLMENA', '515.127.4566', TO_DATE('08/10/1999 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'PU_CLERK', 11500, 114, 30);
Expected data in employees_2_target after 2nd loads (I have given only few columns)
EMPLOYEE_ID SALARY MANAGER_ID DEPARTMENT_ID GRP_NUM GRP_ID
114 11000 100 30 1 1
115 3100 100 30 2 1
116 2900 114 30 1 2
117 2800 114 30 2 2
118 2600 114 30 3 2
119 2500 114 30 4 2
400 18000 100 30 3 1
401 8100 100 30 4 1
512 8200 114 30 5 2
513 11500 114 30 6 2Thanks
Raghu
Similar Messages
-
How to avoid grouping by date with dates as incoming parameters?
Hello, I have the following Query from SAP Business One set as DataSource:
SELECT T1.SlpName as 'Vendor', convert(varchar(12), T0.[U_ER_PROV])as 'City', T0.[CardCode] as 'Client Code', T3.CardName as 'Client Name', T0.DocDate as 'Date', T2.ItemCode, T4.ItemName as 'Reference Description', sum (T2.Quantity) as 'Toal Units per Reference',
avg (T2.Price)as 'Average Price', sum(T2.LineTotal) as 'Total'
FROM ODLN T0
INNER JOIN OSLP T1
ON T0.SlpCode = T1.SlpCode
INNER JOIN DLN1 T2
ON T0.DocEntry = T2.DocEntry
INNER JOIN OCRD T3
ON T0.CardCode = T3.CardCode
INNER JOIN OITM T4
ON T2.ItemCode = T4.ItemCode
group by T1.SlpName, convert(varchar(12), T0.[U_ER_PROV]), T0.[CardCode], T4.ItemName, T0.DocDate, T2.ItemCode, T3.CardName
order by T1.SlpName, convert(varchar(12), T0.[U_ER_PROV]), T0.CardCode, T0.DocDate, T2.ItemCode
What I´d like to do is, grouping in Crystal Reports, the result of this query by Item Code, not by date. The problem I have is that I need users introduce "from date" to "end date" as incoming paramater.
The way I am running it, for example I have some results like:
date Item Code Total
01/01/2009 4646_R2 120 u20AC
10/01/2009 4646_R2 34 u20AC
And I´d like to take something like this:
Item code Total
4646_R2 154 u20AC
Not grouping by date ......
Is there any way to do this using this query in Crystal Reports?
Thanks very much for your time.
Miguel A. VelascoHello all, thanks very much to Raghavendra for his helpfully answer.
I followed your coments and now the report is running fine.
Thanks again for your help without expecting anything in return.
Miguel Velasco -
How can i select some row from multiple row in the same group of data
I want to select some row from multiple row in the same group of data.
ColumnA
Column B
1 OK
1 NG
2 NG
2 NG
3 OK
3 OK
I want the row of group of
ColumnA if ColumnB contain even 'NG'
row , select only one row which Column B = 'NG'
the result i want =
ColumnA Column B
1 NG
2 NG
3 OK
Thank youThat's some awful explanation, but I think this is what you were driving at:
DECLARE @forumTable TABLE (a INT, b CHAR(2))
INSERT INTO @forumTable (a, b)
VALUES
(1, 'OK'),(1, 'NG'),
(2, 'NG'),(2, 'NG'),
(3, 'OK'),(3, 'OK')
SELECT f.a, MIN(COALESCE(f2.b,f.b)) AS b
FROM @forumTable f
LEFT OUTER JOIN @forumTable f2
ON f.a = f2.a
AND f.b <> f2.b
GROUP BY f.a -
Grouping of data based on user prompt having a list of dimensions
Hi All,
I have a requirement to be able to group data in OBIEE request or Dashboard based on user prompt selection.
The prompt should list the Dimensions Available
e.g.
Dimensions: Product, Region, Employee
Fact: Sales
The report is to display sales total for the quarters of the current year.
The user prompt should list the available dimensions (In this case - Location, Employee and Product).
If I choose Product, the data is to be grouped by Products - Layout having a simple tabular grouping with Product names as Group headings.
Similarly any other choice of Dimension from the prompt should group the data by that dimension and have the dimension values used in the group headings.
How could we implement this? I understand this type of requirement (ability to choose dimension) is met in some OLAP reporting tools.
I have used multiple views and the View Selector for similar requirements previously, but looking for a dynamic solution here.
Any pointers or solution will be great.
Thanks,
Kiran
Edited by: Kiran Kudumbur on Sep 8, 2009 5:43 PM
Edited by: Kiran Kudumbur on Sep 9, 2009 12:42 PM
Edited by: Kiran Kudumbur on Sep 10, 2009 2:26 PMHi All,
I used column view to address this requirement.
Thanks,
Kiran -
TSQL query to calculate Count / Sum grouping by date on a Pivot Table
Hi All
I need help to group the pivot table output to group by dates and sum/count the values. I have a table like shown below.
Date
Student
Subject
Hunt
Marks
18/02/2014
Sam
Maths
1
20
18/02/2014
Sam
Maths
1
10
18/02/2014
Sam
Maths
2
30
18/02/2014
Luke
Science
1
50
17/02/2014
Sam
Maths
2
50
17/02/2014
Luke
Science
2
60
16/02/2014
Luke
Science
2
20
16/02/2014
Luke
Science
3
20
I want to Group by dates and move the Hunt to columns calculating their counts and sum their marks too. Like given below.
I wrote a pivot query like below but If i group it with dates and calculate the total marks it throws aggregate errors.
Create Table Student_Log ([Date] datetime ,Student varchar (20), Subject varchar (20) ,Hunt int ,Marks int )
Go
INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Sam ','Maths','1','20')
INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Sam ','Maths','1','10')
INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Sam ','Maths','2','30')
INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Luke','Science','1','50')
INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-17 15:00:00.000','Sam ','Maths','2','50')
INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-17 15:00:00.000','Luke','Science','2','60')
INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-16 15:00:00.000','Luke','Science','2','20')
INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-16 15:00:00.000','Luke','Science','3','20')
Go
select * from Student_Log
select [DATE] , [Student], [Subject] ,[1],[2],[3],[4],Total =([1]+[2]+[3]+[4])
from
( select [Date], [Student], [Subject],[Hunt],[Marks] from Student_Log
)x
pivot
count ( [Hunt]) for [Hunt]
in ([1],[2],[3],[4])
)p
order by [Date] desc
I have done this far only. More than this I need to enhance it with the Percentage of Hunts for each Student.
ie like below table.
On 18th Sam in Maths he had 2 rows on 1st hunt and 1 row on 2nd hunt. So On the Pivot table is it possible to represent it on percentage using the Total Attempts column.
Thanks a lot in advance.
Its runnung in SQL 2000 Server.Create Table Student_Log ([Date] datetime ,Student varchar (20), Subject varchar (20) ,Hunt int ,Marks int )
Go
INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Sam ','Maths','1','20')
INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Sam ','Maths','1','10')
INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Sam ','Maths','2','30')
INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-18 15:00:00.000','Luke','Science','1','50')
INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-17 15:00:00.000','Sam ','Maths','2','50')
INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-17 15:00:00.000','Luke','Science','2','60')
INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-16 15:00:00.000','Luke','Science','2','20')
INSERT INTO Student_Log ([Date],Student, [Subject],Hunt,Marks) VALUES('2014-02-16 15:00:00.000','Luke','Science','3','20')
Go
select * from Student_Log
;with mycte as
Select [Date], [Student], [Subject] ,
Count(CASE WHEN [Hunt]=1 Then Hunt End) as Hunt1,
Count(CASE WHEN [Hunt]=2 Then Hunt End) as Hunt2,
Count(CASE WHEN [Hunt]=3 Then Hunt End) as Hunt3,
Count(CASE WHEN [Hunt]=4 Then Hunt End) as Hunt4,
Count(CASE WHEN [Hunt]=1 Then Hunt End)
+Count(CASE WHEN [Hunt]=2 Then Hunt End)
+Count(CASE WHEN [Hunt]=3 Then Hunt End)+
+Count(CASE WHEN [Hunt]=4 Then Hunt End) as Total,
ISNULL(SUM(CASE WHEN [Hunt]=1 Then Marks End),0) as Mark1,
ISNULL(SUM(CASE WHEN [Hunt]=2 Then Marks End),0) as Mark2,
ISNULL(SUM(CASE WHEN [Hunt]=3 Then Marks End),0) as Mark3,
ISNULL(SUM(CASE WHEN [Hunt]=4 Then Marks End),0) as Mark4
from Student_Log
Group By [Date], [Student], [Subject]
Select [Date], [Student], [Subject]
, Cast(Hunt1*1./Total*100 as int) as [1]
, Cast(Hunt2*1./Total*100 as int) as [2]
,Cast(Hunt3*1./Total*100 as int) as [3]
,Cast(Hunt4*1./Total*100 as int) as [4]
,Total,Marks=( Mark1+Mark2+Mark3+Mark4)
from mycte
order by [Date] DESC, Student desc
drop table Student_Log -
Grouping of Individual groups of Data Template in the RTF
Hi All,
We have a scenario where we may require the grouping of Individual groups of Data Template in the RTF.
Lets say
1. I have group of Invoices with the Group Name G_INV
2. I have a list of Payments done for the Invoices under G_PAY
3. I also have a list of Prepayment Applications that are happened on the Invoices G_PRE
All the three groups G_INV, G_PAY, and G_PRE are independent and they are at same level
G_INV (Main Header)
G_PAY (Main Header)
G_PRE (Main Header)
Extract
<ROOT>
<G_INV>
<INV>I1</INV>
</G_INV>
<G_INV>
<INV>I2</INV>
</G_INV>
<G_INV>
<INV>I3</INV>
</G_INV>
<G_PAY>
<PAY>P1</PAY>
<INV>I1</INV>
</G_PAY>
<G_PAY>
<PAY>P2</PAY>
<PAYINV>I2</PAYINV>
</G_PAY>
<G_PRE>
<PRE>PRE1</PRE>
<PREINV>I1</PREINV>
</G_PRE>
</ROOT>
But in the Report output,
we need the data to be displayed as follows
G_INV (Main Header)
G_PAY (Sub Group of Payments)
G_PRE (Sub Group of Prepayments)
Output
I1
P1
PRE1
I2
P2
I3
So, Can you please suggest us,
Whether we can get these Individual groups into the above required hierarchical manner. If so, please let us know how to achieve the same.
Also, it will be great if you advice us regarding the Performance, how best will be if we group the queries in this heirarchical manner in the RTF rather than getting the hardcoded dependency through linking of the Data Queries in the Data Template file.
Thanks,
Praveen GHi
I dont think you can stop the table growing using Word controls. The easiest way to do it would be to limit the amount of data coming in.
<?for-each:LOOPELEMENT[position()<5]?>
This is take only the first 5 rows
Tim -
Grouping of Data in Advanced Datagrid
Hii,
I need to group the data in advanced datagrid. I used the Grouping collection class, but it it not working.
My advanced datagrid has column groups...so will this have any impact on grouping.
Thanks!!
VikasAssuming that the table (say WALK_IN_PER_LOG) that you have has atleast the following two columns
walk_in_date DATE -- holds date time stamp
dob DATE -- holds date of birth
SELECT TO_CHAR(walk_in_date,'WW')| |'-'| |TO_CHAR(walk_in_date,'DAY') "Week#-Day"
,TO_CHAR(TRUNC(TO_CHAR(walk_in_date,'HH24')/02),'09')| |'-'| |
TO_CHAR(TRUNC(TO_CHAR(walk_in_date,'HH24')/02)+2,'09')
,COUNT(*)
FROM walk_in_per_log
WHERE MONTHS_BETWEEN(SYSDATE,dob) > 18*12
GROUP BY TO_CHAR(walk_in_date,'WW')| |'-'| |TO_CHAR(walk_in_date,'DAY')
,TO_CHAR(TRUNC(TO_CHAR(walk_in_date,'HH24')/02),'09')| |'-'| |
TO_CHAR(TRUNC(TO_CHAR(walk_in_date,'HH24')/02)+2,'09')
PS I might have complicated the query a little in trying to get the formatting as you had requested but the principle is simple
First group by the day, so that all events of one day can be compared together, then extract the hour portion of each of those dates and divide by 2 and use the quotient of the division as a grouping factor.
eg
from hours
00-02 the quotient is 0 (2 is taken as 1:59:59)
02-04 the quotient is 1 (4 is taken as 3:59:59)
and so on
hope this helps.... -
Hello team,
I have come up with a question at my work.
I have a table that has several fields. When I group the data with one field, I get some counts which are equal to the original count of field before grouping. As I add more fields to the query and I add to my grouping, the my total count wouldn't be equal
to the original count of the column.
Can somebody please this?
What query can take care of this?
I generated this select statement, but it didn't work.
SELECT DISTINCT c.code, c.Approved, Year(b.Date) AS [Year], Month(b.Date) AS [Month]
FROM (SELECT a.Code, Sum(a.Approved) AS Approved FROM [MyTable1] AS a WHERE (((a.Approved)>0)) GROUP BY a.Code)
AS c INNER JOIN [MyTable2] AS b ON c. code = b. Code;
Regards,
GGGGGNNNNN
GGGGGNNNNNHi GGGGGNNNNN,
I am not bale to understand the count of field means. Did it mean the numbers of records? If I understand correctly, I think the result is expected since the group by clause is changed.
Here are some articles about SQL in Access for your reference:
SELECT Statement (Microsoft Access SQL)
GROUP BY Clause (Microsoft Access SQL)
Regards & Fei
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How to show 2 groups of data in 1 XY plot at different time?
Hi, all:
I have a question and hope someone can help me figure out the solution or whether or not no solution for the question. I need to collect 2 groups of data [x(n),y(n)] and [x(n),z(n)]. I will collect x-y first then x-z. I need to collect and show the x-y data first, when I am satisfied, then collect and show the x-z data. It should be in the same plot. I got an error message so far and cold not figure out the solution. I attached my code and hope someone can help me. The code is in version 8.0 and I am sure there is no virus. Thank you a lot in advance.
Attachments:
plots.vi 13 KBHello ccyang
When you look the context help of the xy-graph in the diagram, you see the supported data types. An array of xy-clusters is accepted. You may look in the attached code how you could built the array of the two plots.
Check the example VIs included in LabVIEW (in the help menu). There are several examples on charts and graphs.
Greetings
shb
Attachments:
plots executable.vi 15 KB -
Group by Date in Library in iMovie 10
For some reason, I can't find the Group By Date feature that iMovie 9 had in iMovie 10? I can't group my library by year like I did in previous versions?
I went to another forum and the suggestion there was to revert to iMovie 9 I asked how. If you go to your applications folder on your Mac you will find the original iMovie 9. I clicked on the folder, opened it, there is the original iMovie 9 version. I dragged it to the tool bar and now I continue to use Imovie 9 which has all the bits I need; ie sort by dates, able to share to iDVD etc. I removed the iMovie 10 from the tool bar and will await to see if Apple begins to listen to it's customers or continues down the line of "we know best what you want."
Sorry it's the only solution I've found -
I am trying to arrange my photostream saved search (which doesn't update automatically after I did the search for the first time which is very annoying) but finder won't let me arrange in ascending order of date (i.e.: oldest to newest). Is there a way I can do this or will my folder arrangements always be the one way without the option to change it to the opposite arrangement (same for alphabetical). Also, Finder automatically arranges my photos into groups of dates (e.g.: 'previous 30 days', 'September'). Is there any way I can turn this off?
Also if anyone can fix this stupid photostream issue for me that would be great!
thanks very muchEven in list view, the photos are grouped by previous seven days, previous 30 days, October, and so on.. there is no option i see that will let me change to order by date modified without these groupings or to just turn these groupings off altogether
but thank you for your reply
-Peelo2311 -
Displaying a group of data in different Pages
Hello
I will try to explain my Problem below briefly
I have a problem with displaying a group of data in different Pages.I want to display a group of data like this:
page1 page2
data1Part1 data1Part2
Page3 Page4
data2Part1 data2Part2
Page5 Page6
data3Part1 data3Part2
page 7 Page 8
data4Part1 data4Part2
What I get is :
page1 page2
data1Part1 data2Part1
Page3 b]Page4
data3Part1 data4Part1
Page5 Page6
data2Part2 data3Part2
page 7 Page 8
data4Part2 data4Part2
I test <?for-each-group@section:ROW?> and Different first page etc. It doesn't work.I would appreciate your help. I can send you the output, template and xml doc, if you can have a look at it.
ThanksSend me all files along with expected output at [email protected]
-
Displaying a group of data in different colums
I have a problem with displaying a group of data in different colums. I want to display a group of data like this:
Column 1 --- Column2 ----- Column3
data1 data6 data11
data2 data7 data12
data3 data8 data13
data4 data9 data14
data5 data10 data15
That is, the coulm headers must be at the same height of the page and data must be in paralell columns.
My number of data is variable depending on a query result, and I want to start displaying my group on the first column and when it is full (the number of records per column is fixed), is must switch into the next one.
In case there were more than 15 records, the 16th and the followings, must be displayed on the next page, with the same format as i have explained before.
Thank you very much.Send me all files along with expected output at [email protected]
-
Events are not grouped by date
Recently I had a crash on my iPhoto and had to basically re-input all 60,000 photos. All went well and iPhoto working okay now. Only issue is the events are not grouped by date anymore. meaning I have several events that are on the same date. All the setting appear to be correct.
Is there a way to have iPhoto regroup the events all by date?The only way to sort events is the view menu --> sort events - Using it you can re-sort events a few ways
Events are not categorized so there is no way to "re-categorize" them
What you need to do is to restore your backup of the iPhoto library from before the crash that caused you to import your masters folder into iPhoto
And probably if you had rebuild the library after the crash you would have been OK - Back up your iPhoto library, Depress and hold the option (alt) and command keys and launch iPhoto - from the resulting first aid window repair permissions and if necessary rebuild your database -- this will not help on the new library that you created - it has to be done on the bad library that resulted from the crash
LN -
Add business partner to target group - some data missing
Hello,
I created a target group. This target group includes data of person and the associated data of organization (for example: city, street, ...). Now I want add some other person. I have two opportunities when I have open the target group:
1. In the table of the target group
In the column "Business Partner ID" I can open the input help and search the person which I want add zu the target group
2. In the view of the target group
On the top there is a button "Import Business Parterns", there I can upload txt files with the bp-no. from the person.
It works only the first possibility. There are all data of person and organization included.
At the second possibility there are the data of person included, but it lacks the data of organization and I don't know why.
Does anybody know, what's the problem? Is it standard or is it a bug?
Thank you in advance.
Best regards, JasminFor information:
When you want add business partner by file upload to the target group, in the SAP standard the target group can handle only one ID, either the account ID or th contact ID. So when I add some contact IDs by file upload to the target group then I miss the data of the account. So, I have to build up the same target group a second time. -
IPhoto '06 - '08 Import Issues: Album Names Not Imported; Grouped by Date
I imagine my circumstances aren't uncommon... After a clean install of Leopard and iLife '08 on my MacBook, I wanted to import my iPhoto '06 library into iPhoto '08. I had archived on an external hard drive the iPhoto Pictures directory from iPhoto '06 (the directory from ~user/Documents/Pictures/iPhoto Pictures/).
Using the File>Import to Library function in iPhoto '08 and selecting the iPhoto '06 library resulted in all of the pictures coming in, *but they weren't organized in the albums I created in iPhoto '06*. Instead, all pictures were organized into groups by date.
What in the ham sandwich is the proper way to import an iPhoto '06 library so that all of the old album names and organization is maintained in iPhoto '08?
Many thanks for your time!TD,
Many thanks for the advice. I found one other thing that I wanted to ask about before giving this a whirl.
I noticed that the iPhoto Library in '08 is in fact a package, not a directory. Given that, there are two possible courses of action, and I wanted to know which was best.
1. Delete the iPhoto '08 "iPhoto Library" package and replace it with the '06 "iPhoto Library" directory.
2. Replace the contents of the '08 "iPhoto Library" package with the contents of the '06 "iPhoto Library" directory?
I was uncertain about option 1, as I didn't know how getting rid of the package would affect the application (or if it's needed).
Cheers,
R
Maybe you are looking for
-
[SOLVED] Openbox autostart no longer working since upgrade
After the upgrade on May 14 2013 my autostart file no longer works. I tried renaming my autostart.sh to just autostart no luck. There is nothing wrong with the autostart file as I can run it manually and it will load all my apps. Also, if I cd to /u
-
DB & Tomacat on different server, How to create DBCP?
If DB svr and Tomcat on same server, DBCP works ok. Now, I am setup my programing enviornment based on Windows XP, Eclipse, lomboz, Tomcat, MySQL connector/J, but MySQL database is on another Linux server. I tried, but I still get error: ============
-
Hey everyone, So I am trying to get a report onto the server, and in BIDS I kept getting a login screen repeating over and over when I tried to deploy my report, so I tried to upload the file at http://<servername>/Reports This worked, but then tryin
-
Purchase order history already inconsistent -- Quantity * * Value**
Hi experts, Please note that I am trying to reverse a GR/IR account maintanence document. But it throws the below error for a line item in the PO. Purchase order history already inconsistent --> Quantity10,000- SET Value 3,96 AED For this line item a
-
Thinking Cap's On Please: How to create a range in PL/SQL similar to C++
Okay, I had to step on go "Whoa!" Goal: to write a segment of code that will detect and identify a value in a range and then replace it by the following progress on the next element. In other words range A . . Z, and value is current set to D. I want