Alternate to this(joins)
SELECT
ISNULL(LastMember.DimMemberId, -1) AS PrevMemberId
,ISNULL(Member.DimMemberId, -1) AS DimMemberId
,ISNULL(LASTMembership.DimMembershipId, -1) AS PrevMembershipId
,ISNULL(CurrentMembership.DimMembershipId, -1) AS DimMembershipId
,ISNULL(MemberActivity.MemberActivityId, -1) AS MemberActivityId
,ISNULL(MembershipActivity.MembershipActivityId, -1) AS MembershipActivityId
,CAST(CONVERT(CHAR(8), CurrentMembership.Meta_DateRowEff, 112) AS INT) AS MemberActivityDateId
,-1 as DimEmployeeId
,member.MembershipNum
,member.MemberNum
FROM
(SELECT DimMembershipId, MembershipNum ,ServiceLevelId, Meta_DateRowEff
FROM DW.Dim_Membership
WHERE Meta_IsCurrent = 'Y' AND ServiceLevelId > -1
AND Meta_DateRowEff > GETDATE()-30) AS CurrentMembership
INNER JOIN
(SELECT SL.DimMembershipId,SL.MembershipNum, SL.ServiceLevelId
FROM
(SELECT DimMembershipId,MembershipNum ,ServiceLevelId, Meta_DateRowExp
FROM DW.Dim_Membership
WHERE Meta_IsCurrent = 'N' AND ServiceLevelId > -1) AS SL
LEFT OUTER JOIN
(SELECT DimMembershipId,MembershipNum, MAX(Meta_DateRowExp) AS MAXMeta_DateRowExp
FROM DW.Dim_Membership
WHERE Meta_IsCurrent = 'N' AND ServiceLevelId > -1
GROUP BY MembershipNum,DimMembershipId) AS MD
ON MD.MembershipNum = SL.MembershipNum AND MD.MAXMeta_DateRowExp = SL.Meta_DateRowExp
WHERE MD.MAXMeta_DateRowExp IS NOT NULL) AS LastMembership
ON CurrentMembership.MembershipNum = LastMembership.MembershipNum
AND CurrentMembership.ServiceLevelId <> LastMembership.ServiceLevelId
LEFT OUTER JOIN
(SELECT DimMemberId, MembershipNum, MemberNum ,ServiceLevelId
FROM DW.Dim_Member
WHERE Meta_IsCurrent = 'Y' AND ServiceLevelId > -1
AND Meta_DateRowEff > GETDATE()-30) AS Member
ON Member.MembershipNum = CurrentMembership.MembershipNum
---- when i join this part of code, my query is bringing more results it is running for ever and throwing me out of memory execption error.
--can you please tell me the alternative way for this code
INNER JOIN
(SELECT ST.DimMemberId,ST.MembershipNum,ST.MemberNum, ST.ServiceLevelId
FROM
(SELECT DimMemberId,MembershipNum,MemberNum ,ServiceLevelId, Meta_DateRowExp
FROM DW.Dim_Member
WHERE Meta_IsCurrent = 'N' AND ServiceLevelId > -1) AS ST
LEFT OUTER JOIN
(SELECT DimMemberId,MembershipNum,MemberNum, MAX(Meta_DateRowExp) AS MAXMeta_DateRowExp
FROM DW.Dim_Member
WHERE Meta_IsCurrent = 'N' AND ServiceLevelId > -1
GROUP BY MemberNum,MembershipNum,DimMemberId) AS MD
ON MD.MembershipNum = ST.MembershipNum AND MD.MAXMeta_DateRowExp = ST.Meta_DateRowExp
WHERE MD.MAXMeta_DateRowExp IS NOT NULL) AS LastMember
ON CurrentMembership.MembershipNum = LastMember.MembershipNum
AND Member.ServiceLevelId <> LastMember.ServiceLevelId
CROSS JOIN
(SELECT TOP 1 DimActivityId as MemberActivityId FROM
(SELECT DimActivityId, 1 AS ORD
FROM DW.Dim_Activity
WHERE ActivityClass = 'Member'
AND ActivityType = 'Serv Lvl Change'
AND ActivitySubType = 'Serv Lvl Change'
AND Meta_IsCurrent = 'Y'
UNION ALL
SELECT -1 AS DimActivityId, 2 AS ORD) T
ORDER BY ORD) AS MemberActivity
CROSS JOIN
(SELECT TOP 1 DimActivityId as MembershipActivityId FROM
(SELECT DimActivityId, 1 AS ORD
FROM DW.Dim_Activity
WHERE ActivityClass = 'Membership'
AND ActivityType = 'Serv Lvl Change'
AND ActivitySubType = 'Serv Lvl Change'
AND Meta_IsCurrent = 'Y'
UNION ALL
SELECT -1 AS DimActivityId, 2 AS ORD) T
ORDER BY ORD) AS MembershipActivity
CREATE TABLE [DW].[Dim_Membership](
[DimMembershipId] [bigint] IDENTITY(1,1) NOT NULL,
[MembershipNum] [int] NOT NULL,
[ServiceLevelId] [int] NOT NULL,
[Meta_IsCurrent] [char](1) NOT NULL,
[Meta_DateRowEff] [datetime] NOT NULL,
CONSTRAINT [PK_Dim_Membership] PRIMARY KEY CLUSTERED
[DimMembershipId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [DW]
) ON [DW]
CREATE TABLE [DW].[Dim_Member](
[DimMemberId] [bigint] IDENTITY(1,1) NOT NULL,
[MembershipNum] [int] NOT NULL,
[MemberNum] [tinyint] NOT NULL,
[ServiceLevelId] [int] NOT NULL,
[Meta_IsCurrent] [char](1) NOT NULL,
[Meta_DateRowEff] [datetime] NULL,
CONSTRAINT [PK_Dim_Member] PRIMARY KEY CLUSTERED
[DimMemberId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [DW]
) ON [DW]
CREATE TABLE [DW].[Dim_Activity](
[DimActivityId] [int] IDENTITY(1,1) NOT NULL,
[ActivityClass] [varchar](50) NOT NULL,
[ActivityType] [varchar](50) NOT NULL,
[ActivitySubType] [varchar](50) NULL,
[Meta_IsCurrent] [char](1) NOT NULL,
CONSTRAINT [PK_Dim_MemberActivity] PRIMARY KEY CLUSTERED
[DimActivityId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [DW]
) ON [DW]
I inserted the code to create tables. I inserted the code in the code block.
Member table is very very huge table. joining member with itself is making this query slow, can you please suggest the other way.
---- when i join below commented part of code, my query is bringing more results it is running for ever and throwing me out of memory execption error.
--can you please tell me the alternative way for code
When this happens, that is, when you get a row explosion that eventually causes SSMS to choke, the cause is usually that you have incomplete join conditions.
I don't know your tables. Well, you posted the CREATE TABLE statements, but all they have is IDENTITY column of for PK, so I don't know rest of the columns. However, this looks suspect:
ON CurrentMembership.MembershipNum = LastMembership.MembershipNum
AND CurrentMembership.ServiceLevelId <> LastMembership.ServiceLevelId
If there are 10 rows for the same MembershipNum with 10 different service level ids, this condition will produce 90 rows. That is 10x10 - the 10 where the service level IDs are the same. And then you add a second condition on the same pattern. We now have
900 rows for the same MembershipNum.
But how you should write your query? No, I don't know, because I don't know what you are looking for.
Erland Sommarskog, SQL Server MVP, [email protected]
Similar Messages
-
Alternate for inner join to improve performance
Hi all,
I have used an inner join query to fetch data from five different tables into an internal table with where clause conditions.
The execution time is almost 5-6 min for this particular query(I have more data in all five DB tables- more than 10 million records in every table).
Is there any alternate for inner join to improve performance.?
TIA.
Regards,
KarthikHi All,
Thanks for all your interest.
SELECT a~object_id a~description a~descr_language
a~guid AS object_guid a~process_type
a~changed_at
a~created_at AS created_timestamp
a~zzorderadm_h0207 AS cpid
a~zzorderadm_h0208 AS submitter
a~zzorderadm_h0303 AS cust_ref
a~zzorderadm_h1001 AS summary
a~zzorderadm_h1005 AS summary_uc
a~zzclose_date AS clsd_date
d~stat AS status
f~priority
FROM crmd_orderadm_h AS a INNER JOIN crmd_link AS b ON a~guid = b~guid_hi
INNER JOIN crmd_partner AS c ON b~guid_set = c~guid
INNER JOIN crm_jest AS d ON objnr = a~guid
INNER JOIN crmd_activity_h AS f ON f~guid = a~guid
INTO CORRESPONDING FIELDS OF TABLE et_service_request_list
WHERE process_type IN lt_processtyperange
AND a~created_at IN lt_daterange
AND partner_no IN lr_partner_no
AND stat IN lt_statusrange
AND object_id IN lt_requestnumberrange
AND zzorderadm_h0207 IN r_cpid
AND zzorderadm_h0208 IN r_submitter
AND zzorderadm_h0303 IN r_cust_ref
AND zzorderadm_h1005 IN r_trans_desc
AND d~inact = ' '
AND b~objtype_hi = '05'
AND b~objtype_set = '07'.
f~priority
FROM crmd_orderadm_h AS a INNER JOIN crmd_link AS b ON a~guid = b~guid_hi
INNER JOIN crmd_partner AS c ON b~guid_set = c~guid
INNER JOIN crm_jest AS d ON objnr = a~guid
INNER JOIN crmd_activity_h AS f ON f~guid = a~guid
INTO CORRESPONDING FIELDS OF TABLE et_service_request_list
WHERE process_type IN lt_processtyperange
AND a~created_at IN lt_daterange
AND partner_no IN lr_partner_no
AND stat IN lt_statusrange
AND object_id IN lt_requestnumberrange
AND zzorderadm_h0207 IN r_cpid
AND zzorderadm_h0208 IN r_submitter
AND zzorderadm_h0303 IN r_cust_ref
AND zzorderadm_h1005 IN r_trans_desc
AND d~inact = ' '
AND b~objtype_hi = '05'
AND b~objtype_set = '07'. -
Alternate for this code(joins)
CREATE TABLE [Store](
[StoreId] [int] IDENTITY(1,1) NOT NULL,
[LOC_Name] [varchar](50) NULL,
CONSTRAINT [PK_Store] PRIMARY KEY CLUSTERED
[StoreId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
Insert into [dbo].[Store]
[LOC_Name]
select 'virginia'
union all
select 'chicago'
CREATE TABLE [Employee](
[StoreId] [int] NOT NULL,
[Emp_NAME] [nvarchar](70) NULL,
) ON [PRIMARY]
Insert into [dbo].[Employee]
[StoreId]
,[Emp_NAME]
select 1,'daniel'
union all
select 1,'jack'
union all
select 1,'roger'
union all
select 1,'matt'
union all
select 2,'sam'
union all
select 2,'henry'
union all
select 2,'eston'
union all
select 2,'robert'
union all
select 2,'nadal'
CREATE TABLE [Customer](
[CustomerId] [int] IDENTITY(1,1) NOT NULL,
[StoreId] [int] NOT NULL,
[CUST_NO] [nvarchar](11) NULL,
CONSTRAINT [PK_Customer] PRIMARY KEY CLUSTERED
[CustomerId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
set identity_insert [CCC_STAGE].[dbo].[Customer_test] on
Insert into [CCC_STAGE].[dbo].[Customer_test]
[CustomerId]
,[StoreId]
,[CUST_NO]
select 201,1,897456
union all
select 202,1,974652
union all
select 203,1,276294
union all
select 204,1,612348
union all
select 205,2,187906
union all
select 206,2,289123
union all
select 207,2,427403
union all
select 208,2,591654
union all
select 209,2,904563
-------------- Query to retrieve In each location each employee is working on how many customers--
select [LOC_NAME],
B.[Emp_NAME],
COUNT(distinct C.[CUST_NO]) TOTAL_CUSTOMERS
FROM [CCC_STAGE].[dbo].[Store] A
join [CCC_STAGE].[dbo].[Employee] B
on A.StoreId=B.StoreId
join [CCC_STAGE].[dbo].[Customer] c
on B.StoreId=C.StoreId
--where LOC_NAME='virginia'
--where LOC_NAME='chicago'
group by [LOC_NAME]
,B.[Emp_NAME]
ORDER BY [LOC_NAME],B.[Emp_NAME]
Hi Everyone,
I inserted the code creating tables and inserting values to tables and also there is a query which retrieves the data from the tables I created.
In this scenario, what we need to get is.....
we need to find out in each location, each employee is working on how many customers, but with the query I wrote I get the data like, all the employee's are working on all the customers. Below is the output I should get
loc_name emp_name total_customers
chiacgo eston 1
Chicago henry 2
Chicago nadal 2
Chicago Robert 1
but I am getting the below output which is in correct
loc_name emp_name total_customers
chiacgo eston 5
Chicago henry 5
Chicago nadal 5
Chicago Robert 5
Why I am getting this out put can any one tell me please.... I am getting an out put like all the employees are working on all the customers.
Thanks
vishuThank you for trying to post DDL; unfortunately, you got it wrong. You also writer really bad SQL code. Only one store and one Personnel? And Personnel is not an attribute of store! We do not use IDENTITY in RDBMS, etc.
CREATE TABLE Stores
(store_duns CHAR(9) NOT NULL PRIMARY KEY, -- wrong!
store_location VARCHAR(50) NOT NULL);
The DUNS is the industry standard for a business identifier, but let's keep your INTEGER for now. A location should be on the same scale – that means a city-state location name.
Do you really have only one employee, as you said? Why do you think a store is an attribute of this one guy? You have a relationship table here. Tables must have keys.
Why did you use a emp_name NVARCHAR(70) as a key??
CREATE TABLE Store_Assignments
(emp_id CHAR(10) NOT NULL
REFERENCES Personnel (emp_id)
PRIMARY KEY,
store_duns CHAR(9) NOT NULL
REFERENCES Stores(store_duns));
Customers also do not have a store as an attribute! They have a relationship. Is it 1:1, 1:m, n:m or what?? I will guess 1:1. D ou know what that means? You seem to have no idea how to write a basic schema.
CREATE TABLE Customer_Assignments
(customer_id CHAR(16) NOT NULL PRIMARY KEY
REFERENCES Customers(customer_id)
ON DELETE CASCADE ,
store_duns CHAR(9) NOT NULL
REFERENCES Stores(store_duns)
ON DELETE CASCADE);
>> we need to find out in each location, each employee is working on how many customers, but with the query I wrote I get the data like, all the employee’s are working on all the customers. <<
Your design is garbage. Where did you assign a customer to an employee? (“Hello, my name is Joe and I will be your salesman/waiter!”). The location of a store is unimportant for this. You need:
CREATE TABLE Customer_Agent
(customer_id CHAR(16) NOT NULL PRIMARY KEY
REFERENCES Customers(customer_id)
ON DELETE CASCADE,
emp_id CHAR(9) NOT NULL
REFERENCES Personnel(emp_id)
ON DELETE CASCADE);
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
How can i improve on this join clause
I have a table like this
desc work_table2
WORK_TABLE2_ID NOT NULL NUMBER
APPLICATION_ID NUMBER
APPLICATION_VERSION NUMBER
JOB_ID NUMBER
CUSTOMER_ID NUMBER
ATTRIBUTE_ID NUMBER
TEMPLATE_ID NUMBER
DISTRICT_ID NUMBER
SCHOOL_OID VARCHAR2(32)
PERSON_OID VARCHAR2(32)
CREATE_DATETIME DATE
SCHEMA_NAME VARCHAR2(32)
TABLE_NAME VARCHAR2(32)
COLUMN_NAME VARCHAR2(32)
ROW_ID NUMBER
VALUE VARCHAR2(100)
ACTION VARCHAR2(15)
CIA_VERSION NOT NULL NUMBER
SUB_ROW_ID NUMBER(9)
This is table from which I will be inserting data into other tables. Some sort of standby data table.
Data in this table comes in column format which i
convert into a row. i.e for 1 row in the target table comprises of 10 columns
then i get 10 different rows for that in work_table2
The important columns here are table_name, column_name, value which gives me
the table in which i have to insert the values, the columns of the table & the required values.
I create views out of this table so i can directly insert into the destination tables from
the views. The tables to insert into reside in another schema.
Apart from these columns I also require the job_id, customer_id, action column
which are part of the tables i am going to insert into but will not come from the
column_name column of the work_table2 but do come as separate columns in work_table2
For every row to be inserted into the table i take row_id as the separator and
use it in my join clause
In some cases i get the same row_id for two different rows so i use sub_row_id to get individual rows.
In some cases it is quite possible that i may not get data for few of the columns of the target table. In that case I have I have to show null values in the empty columns
Here is the query i use to create the view. Actually i have created a view generator
PLSQL code which automatically creates views for all the tables.
Though this query gives me the desired output I am very scared looking at the join clause
Could you suggest a better way to get the output
CREATE OR REPLACE VIEW CDL_BELLPERIODMASTER
( OID, CUSTOMER_ID, ORGUNIT_OID, BELLPERIODSET_OID, PERIOD_NUMBER,
SHORT_LABEL, NAME, DESCRIPTION, BEGIN_TIME,
END_TIME, CREATEDBY_OID, CREATEDATE, UPDATEDATE,
ORIGINTYPECD_OID, OWNER_ORGUNIT_OID, CREATE_BY, UPDATE_BY,
UPDATE_DATE, YEAR_TAGGED, APPLICATION_VERSION, INACTIVESTATUS,
ISDELETED, JOB_ID, ACTION )
AS
SELECT OID.value,CUSTOMER_ID.value,ORGUNIT_OID.value,BELLPERIODSET_OID.value,
PERIOD_NUMBER.value,SHORT_LABEL.value,NAME.value,DESCRIPTION.value,
BEGIN_TIME.value,END_TIME.value,CREATEDBY_OID.value,CREATEDATE.value,
UPDATEDATE.value,ORIGINTYPECD_OID.value,OWNER_ORGUNIT_OID.value,
CREATE_BY.value,UPDATE_BY.value,UPDATE_DATE.value,
YEAR_TAGGED.value,APPLICATION_VERSION.value,INACTIVESTATUS.value,
ISDELETED.value,jobs.job_id, act. action
FROM
(SELECT value , row_id, job_id, sub_row_id FROM work_table2
WHERE table_name='WSF_BELLPERIODMASTER' and column_name ='OID') OID,
(SELECT TO_NUMBER(VALUE) value , row_id, job_id, sub_row_id FROM work_table2
WHERE table_name='WSF_BELLPERIODMASTER' and column_name ='CUSTOMER_ID') CUSTOMER_ID,
(SELECT value , row_id, job_id, sub_row_id FROM work_table2
WHERE table_name='WSF_BELLPERIODMASTER' and column_name ='ORGUNIT_OID') ORGUNIT_OID,
(SELECT value , row_id, job_id, sub_row_id FROM work_table2
WHERE table_name='WSF_BELLPERIODMASTER' and column_name ='BELLPERIODSET_OID')
BELLPERIODSET_OID,
(SELECT TO_NUMBER(VALUE) value , row_id, job_id, sub_row_id FROM work_table2
WHERE table_name='WSF_BELLPERIODMASTER' and column_name ='PERIOD_NUMBER')
PERIOD_NUMBER,
(SELECT value , row_id, job_id, sub_row_id FROM work_table2 WHERE
table_name='WSF_BELLPERIODMASTER' and column_name ='SHORT_LABEL') SHORT_LABEL,
(SELECT value , row_id, job_id, sub_row_id FROM work_table2 WHERE
table_name='WSF_BELLPERIODMASTER' and column_name ='NAME') NAME,
(SELECT value , row_id, job_id, sub_row_id FROM work_table2
WHERE table_name='WSF_BELLPERIODMASTER' and column_name ='DESCRIPTION') DESCRIPTION,
(SELECT value , row_id, job_id, sub_row_id FROM work_table2
WHERE table_name='WSF_BELLPERIODMASTER' and column_name ='BEGIN_TIME') BEGIN_TIME,
(SELECT value , row_id, job_id, sub_row_id FROM work_table2
WHERE table_name='WSF_BELLPERIODMASTER' and column_name ='END_TIME') END_TIME,
(SELECT value , row_id, job_id, sub_row_id FROM work_table2 WHERE
table_name='WSF_BELLPERIODMASTER' and column_name ='CREATEDBY_OID') CREATEDBY_OID,
(SELECT TO_DATE(VALUE,'DD-MON-RRRR') value , row_id, job_id, sub_row_id
FROM work_table2 WHERE table_name='WSF_BELLPERIODMASTER' and
column_name ='CREATEDATE') CREATEDATE,
(SELECT TO_DATE(VALUE,'DD-MON-RRRR') value , row_id, job_id, sub_row_id
FROM work_table2 WHERE table_name='WSF_BELLPERIODMASTER'
and column_name ='UPDATEDATE') UPDATEDATE,
(SELECT value , row_id, job_id, sub_row_id FROM work_table2 WHERE
table_name='WSF_BELLPERIODMASTER' and column_name ='ORIGINTYPECD_OID')
ORIGINTYPECD_OID,
(SELECT value , row_id, job_id, sub_row_id FROM work_table2
WHERE table_name='WSF_BELLPERIODMASTER' and column_name ='OWNER_ORGUNIT_OID')
OWNER_ORGUNIT_OID,
(SELECT value , row_id, job_id, sub_row_id FROM work_table2 WHERE
table_name='WSF_BELLPERIODMASTER' and column_name ='CREATE_BY') CREATE_BY,
(SELECT value , row_id, job_id, sub_row_id FROM work_table2
WHERE table_name='WSF_BELLPERIODMASTER' and column_name ='UPDATE_BY') UPDATE_BY,
(SELECT TO_DATE(VALUE,'DD-MON-RRRR') value , row_id, job_id, sub_row_id
FROM work_table2 WHERE table_name='WSF_BELLPERIODMASTER' and
column_name ='UPDATE_DATE') UPDATE_DATE,
(SELECT value , row_id, job_id, sub_row_id FROM work_table2
WHERE table_name='WSF_BELLPERIODMASTER' and column_name ='YEAR_TAGGED') YEAR_TAGGED,
(SELECT value , row_id, job_id, sub_row_id FROM work_table2
WHERE table_name='WSF_BELLPERIODMASTER' and column_name ='APPLICATION_VERSION')
APPLICATION_VERSION,
(SELECT value , row_id, job_id, sub_row_id FROM work_table2
WHERE table_name='WSF_BELLPERIODMASTER' and column_name ='INACTIVESTATUS')
INACTIVESTATUS,
(SELECT value , row_id, job_id, sub_row_id FROM work_table2
WHERE table_name='WSF_BELLPERIODMASTER' and column_name ='ISDELETED') ISDELETED,
(SELECT decode(upper(ACTION),'W','U',ACTION) action ,row_id, job_id, sub_row_id
FROM work_table2 WHERE table_name='WSF_BELLPERIODMASTER' AND column_name='OID' ) ACT,
(SELECT row_id , job_id, sub_row_id FROM work_table2
WHERE table_name='WSF_BELLPERIODMASTER' AND column_name='OID' ) JOBS
where
OID.job_id=CUSTOMER_ID.job_id(+) and
OID.job_id=ORGUNIT_OID.job_id(+) and
OID.job_id=BELLPERIODSET_OID.job_id(+) and
OID.job_id=PERIOD_NUMBER.job_id(+) and
OID.job_id=SHORT_LABEL.job_id(+) and
OID.job_id=NAME.job_id(+) and
OID.job_id=DESCRIPTION.job_id(+) and
OID.job_id=BEGIN_TIME.job_id(+) and
OID.job_id=END_TIME.job_id(+) and
OID.job_id=CREATEDBY_OID.job_id(+) and
OID.job_id=CREATEDATE.job_id(+) and
OID.job_id=UPDATEDATE.job_id(+) and
OID.job_id=ORIGINTYPECD_OID.job_id(+) and
OID.job_id=OWNER_ORGUNIT_OID.job_id(+) and
OID.job_id=CREATE_BY.job_id(+) and
OID.job_id=UPDATE_BY.job_id(+) and
OID.job_id=UPDATE_DATE.job_id(+) and
OID.job_id=YEAR_TAGGED.job_id(+) and
OID.job_id=APPLICATION_VERSION.job_id(+) and
OID.job_id=INACTIVESTATUS.job_id(+) and
OID.job_id=ISDELETED.job_id(+) and
OID.job_id= ACT.job_id(+) and
OID.job_id = JOBS.job_id(+) and
OID.row_id=CUSTOMER_ID.row_id(+) and
OID.row_id=ORGUNIT_OID.row_id(+) and
OID.row_id=BELLPERIODSET_OID.row_id(+) and
OID.row_id=PERIOD_NUMBER.row_id(+) and
OID.row_id=SHORT_LABEL.row_id(+) and
OID.row_id=NAME.row_id(+) and
OID.row_id=DESCRIPTION.row_id(+) and
OID.row_id=BEGIN_TIME.row_id(+) and
OID.row_id=END_TIME.row_id(+) and
OID.row_id=CREATEDBY_OID.row_id(+) and
OID.row_id=CREATEDATE.row_id(+) and
OID.row_id=UPDATEDATE.row_id(+) and
OID.row_id=ORIGINTYPECD_OID.row_id(+) and
OID.row_id=OWNER_ORGUNIT_OID.row_id(+) and
OID.row_id=CREATE_BY.row_id(+) and
OID.row_id=UPDATE_BY.row_id(+) and
OID.row_id=UPDATE_DATE.row_id(+) and
OID.row_id=YEAR_TAGGED.row_id(+) and
OID.row_id=APPLICATION_VERSION.row_id(+) and
OID.row_id=INACTIVESTATUS.row_id(+) and
OID.row_id=ISDELETED.row_id(+) and
OID.row_id= ACT.row_id(+) and
OID.row_id = JOBS.row_id(+) and
OID.sub_row_id=CUSTOMER_ID.sub_row_id(+) and
OID.sub_row_id=ORGUNIT_OID.sub_row_id(+) and
OID.sub_row_id=BELLPERIODSET_OID.sub_row_id(+) and
OID.sub_row_id=PERIOD_NUMBER.sub_row_id(+) and
OID.sub_row_id=SHORT_LABEL.sub_row_id(+) and
OID.sub_row_id=NAME.sub_row_id(+) and
OID.sub_row_id=DESCRIPTION.sub_row_id(+) and
OID.sub_row_id=BEGIN_TIME.sub_row_id(+) and
OID.sub_row_id=END_TIME.sub_row_id(+) and
OID.sub_row_id=CREATEDBY_OID.sub_row_id(+) and
OID.sub_row_id=CREATEDATE.sub_row_id(+) and
OID.sub_row_id=UPDATEDATE.sub_row_id(+) and
OID.sub_row_id=ORIGINTYPECD_OID.sub_row_id(+) and
OID.sub_row_id=OWNER_ORGUNIT_OID.sub_row_id(+) and
OID.sub_row_id=CREATE_BY.sub_row_id(+) and
OID.sub_row_id=UPDATE_BY.sub_row_id(+) and
OID.sub_row_id=UPDATE_DATE.sub_row_id(+) and
OID.sub_row_id=YEAR_TAGGED.sub_row_id(+) and
OID.sub_row_id=APPLICATION_VERSION.sub_row_id(+) and
OID.sub_row_id=INACTIVESTATUS.sub_row_id(+) and
OID.sub_row_id=ISDELETED.sub_row_id(+) and
OID.sub_row_id= ACT.sub_row_id(+) and
OID.sub_row_id = JOBS.sub_row_id(+)
RgrdsTry to use this sample.
create or replace view v
as
select dept.deptno deptcode, dept.dname deptname, sal amount
from emp, dept
where emp.deptno = dept.deptno
select decode( grouping(rownum), 1, to_number(NULL), deptcode ) deptcode,
deptname || decode( grouping(rownum), 1, ' total amount' ) deptname,
sum(amount),
grouping(deptcode) g1, grouping(deptname) g2, grouping(rownum)
from v
group by rollup(deptcode,deptname,rownum)
having (grouping(deptcode) = 0 and
grouping(deptname) = 0 and
grouping(rownum)=0)
OR (grouping(deptcode) = 0 and
grouping(deptname) = 0 and
grouping(rownum)=1) -
Hi there,
I didn't understand how exactly the query ran and what exactly happened.
Can someone please explain?
SQL> set autotrace on
SQL> select salary,department_name,e.department_id,d.department_id from employees e,departments d where e.department_id>d.department_id and first_name like 'K%';
SALARY DEPARTMENT_NAME DEPARTMENT_ID DEPARTMENT_ID
13500 Public Relations 80 70
13500 IT 80 60
13500 Shipping 80 50
13500 Human Resources 80 40
13500 Purchasing 80 30
13500 Marketing 80 20
13500 Administration 80 10
2400 Human Resources 50 40
2400 Purchasing 50 30
2400 Marketing 50 20
2400 Administration 50 10
SALARY DEPARTMENT_NAME DEPARTMENT_ID DEPARTMENT_ID
3000 Human Resources 50 40
3000 Purchasing 50 30
3000 Marketing 50 20
3000 Administration 50 10
3800 Human Resources 50 40
3800 Purchasing 50 30
3800 Marketing 50 20
3800 Administration 50 10
5800 Human Resources 50 40
5800 Purchasing 50 30
5800 Marketing 50 20
SALARY DEPARTMENT_NAME DEPARTMENT_ID DEPARTMENT_ID
5800 Administration 50 10
2500 Marketing 30 20
2500 Administration 30 10
25 rows selected.
Execution Plan
Plan hash value: 3586199209
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time
|
| 0 | SELECT STATEMENT | | 9 | 612 | 8 (25)| 00:00:0
1 |
| 1 | MERGE JOIN | | 9 | 612 | 8 (25)| 00:00:0
1 |
| 2 | SORT JOIN | | 7 | 266 | 4 (25)| 00:00:0
1 |
|* 3 | TABLE ACCESS FULL| EMPLOYEES | 7 | 266 | 3 (0)| 00:00:0
1 |
|* 4 | SORT JOIN | | 27 | 810 | 4 (25)| 00:00:0
1 |
| 5 | TABLE ACCESS FULL| DEPARTMENTS | 27 | 810 | 3 (0)| 00:00:0
1 |
Predicate Information (identified by operation id):
3 - filter("FIRST_NAME" LIKE 'K%')
4 - access(INTERNAL_FUNCTION("E"."DEPARTMENT_ID")>INTERNAL_FUNCTION("D".
"DEPARTMENT_ID"))
filter(INTERNAL_FUNCTION("E"."DEPARTMENT_ID")>INTERNAL_FUNCTION("D".
"DEPARTMENT_ID"))
Note
- dynamic sampling used for this statement
Statistics
0 recursive calls
0 db block gets
7 consistent gets
0 physical reads
0 redo size
1292 bytes sent via SQL*Net to client
395 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
2 sorts (memory)
0 sorts (disk)
25 rows processedPS: JOIN has to be done with '=' operator. Is this correct?
Thanks
RajivDear Rajiv,
Because you make a join with > sign
Oracle decide
First - search all EMPLOYEES that match you filter condition first_name like 'K%' and ordering then by departament id
Then - Oracle sort all departament on dept table by id
With both sets Sorted, Oracle simply go to one set and check another set, and join then.
Regards
Helio Dias
www.heliodias.com -
Alternate to this PM_ORDER_DATA_READ
Hi
is there any other alternate for thisFM PM_ORDER_DATA_READ either in bapi also.
with regards,
jayasankar.Hi Jya,
after using this
Call that functionmodule in synchronusly,
call function 'PM_ORDER_DATA_READ ' in update task
again it goes to dump and giving the error
Non-update function module called for update.
(or)
when I use STARTING NEW TASK with call function it is throughing an error that
Field "EXPORTING" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement.
but here in my function module i need to export some of the fields and how come i solve this problem can u guide me with detailed infromation.
cheers,
Hema. -
I have 3 tables, let's call them A B and C.
I will use A1, A2 to differentiate between different rows in a table.
A will be the base table.
I want to join B and C to A, but maintain separate rows for each join on B or C
So if would look lik
A1 null C1
A1 B1 null
A1 null C2
A1 B2 null
etc...
Right now - when I do a left outer join on both B and C I am getting repeats on table C
A1 B1 C1
A1 B2 C1
etc....
Is there a way to join two tables to a third table but keep the rows exclusive to each table?
I CAN NOT do a union on B and C.
Thanks in advance for the help - sorry if this is a stupid question.I have 3 tables, let's call them A B and C.
I want to join B and C to A, but maintain separate
rows for each join on B or C
So if would look lik
A1 null C1
A1 B1 null
A1 null C2
A1 B2 null
etc...
Right now - when I do a left outer join on both B and
C I am getting repeats on table C
A1 B1 C1
A1 B2 C1
etc....And so if you have a 9i rel 1 and above database, then you can use a scalar query for each of the other tables like so
SELECT A.A1_COL,
( SELECT B.B1_COL FROM B WHERE B.JOIN_COL = A.JOIN_COL ) AS B_STUFF,
( SELECT C.C1_COL FROM c WHERE C.JOIN_COL = A.JOIN_COL ) AS C_STUFF
FROM A
WHERE A.selection_CONDITIONS....
There are some limitations to scaler queries but creative solutions are available.
Look at in-line views and wrap one around the mess above, if you want
A1, brow, B1
A1, crow, C1
But I shall leave that to your thrill and join of discovery.
HTH,
Greg -
How can I make this join in ADF and make CRUD operation in this
How to make this relation in ADF
I have table employees and this is my master table
Table Name: Employees
Columns:
Employee_id(PK)
Employee_name
Employee_Salary
I have a child table that is called related employee that contains employees related to this employee
Table_name: Related_Employee
Columns:
Related_Employee_Table_Id(PK)
Employee_id(FK)
Related_Employee_Id
When I open employee id = 100 for example and add related employee id = 10
this is added with no problem but the requirement is that when I open employee 10 I find employee id 100 as related employee
How can I make this scenario.The best way to understand this is to look at an example. If you are using an oracle database such as XE for you have a schema called hr. This shema has a number of tables two of which are departments and employees. a department has multiple employees correct. So in your example a employee may be related to x # of other employees perhaps. A very similar scenario as that in the hr Schema. If you don't have an Oracle XE database, download one from here -> http://www.oracle.com/technetwork/database/express-edition/downloads/index.html
Create Business Components off of the Departments and Employees schema and you'll see that due to the db design, you get what you're talking about for free (i.e. the join). Thus, you have the master-detail relationship you're looking for. For a quick tip, here is the relationship between departments and employees in the hr schema via a create script that you can exam with data inserts included:
SET SQLBLANKLINES ON
CREATE TABLE DEPARTMENTS
DEPARTMENT_ID NUMBER(4, 0) NOT NULL
, DEPARTMENT_NAME VARCHAR2(30 BYTE) NOT NULL
, MANAGER_ID NUMBER(6, 0)
, LOCATION_ID NUMBER(4, 0)
, CONSTRAINT DEPT_ID_PK PRIMARY KEY
DEPARTMENT_ID
USING INDEX
CREATE UNIQUE INDEX DEPT_ID_PK ON DEPARTMENTS (DEPARTMENT_ID ASC)
LOGGING
TABLESPACE "USERS"
PCTFREE 10
INITRANS 2
STORAGE
INITIAL 65536
MINEXTENTS 1
MAXEXTENTS UNLIMITED
BUFFER_POOL DEFAULT
ENABLE
LOGGING
TABLESPACE "USERS"
PCTFREE 10
INITRANS 1
STORAGE
INITIAL 65536
MINEXTENTS 1
MAXEXTENTS UNLIMITED
BUFFER_POOL DEFAULT
CREATE TABLE EMPLOYEES
EMPLOYEE_ID NUMBER(6, 0) NOT NULL
, FIRST_NAME VARCHAR2(20 BYTE)
, LAST_NAME VARCHAR2(25 BYTE) NOT NULL
, EMAIL VARCHAR2(25 BYTE) NOT NULL
, PHONE_NUMBER VARCHAR2(20 BYTE)
, HIRE_DATE DATE NOT NULL
, JOB_ID VARCHAR2(10 BYTE) NOT NULL
, SALARY NUMBER(8, 2)
, COMMISSION_PCT NUMBER(2, 2)
, MANAGER_ID NUMBER(6, 0)
, DEPARTMENT_ID NUMBER(4, 0)
, CONSTRAINT EMP_EMP_ID_PK PRIMARY KEY
EMPLOYEE_ID
USING INDEX
CREATE UNIQUE INDEX EMP_EMP_ID_PK ON EMPLOYEES (EMPLOYEE_ID ASC)
LOGGING
TABLESPACE "USERS"
PCTFREE 10
INITRANS 2
STORAGE
INITIAL 65536
MINEXTENTS 1
MAXEXTENTS UNLIMITED
BUFFER_POOL DEFAULT
ENABLE
LOGGING
TABLESPACE "USERS"
PCTFREE 10
INITRANS 1
STORAGE
INITIAL 65536
MINEXTENTS 1
MAXEXTENTS UNLIMITED
BUFFER_POOL DEFAULT
CREATE INDEX DEPT_LOCATION_IX ON DEPARTMENTS (LOCATION_ID ASC)
LOGGING
TABLESPACE "USERS"
PCTFREE 10
INITRANS 2
STORAGE
INITIAL 65536
MINEXTENTS 1
MAXEXTENTS UNLIMITED
BUFFER_POOL DEFAULT
CREATE INDEX EMP_DEPARTMENT_IX ON EMPLOYEES (DEPARTMENT_ID ASC)
LOGGING
TABLESPACE "USERS"
PCTFREE 10
INITRANS 2
STORAGE
INITIAL 65536
MINEXTENTS 1
MAXEXTENTS UNLIMITED
BUFFER_POOL DEFAULT
CREATE INDEX EMP_JOB_IX ON EMPLOYEES (JOB_ID ASC)
LOGGING
TABLESPACE "USERS"
PCTFREE 10
INITRANS 2
STORAGE
INITIAL 65536
MINEXTENTS 1
MAXEXTENTS UNLIMITED
BUFFER_POOL DEFAULT
CREATE INDEX EMP_MANAGER_IX ON EMPLOYEES (MANAGER_ID ASC)
LOGGING
TABLESPACE "USERS"
PCTFREE 10
INITRANS 2
STORAGE
INITIAL 65536
MINEXTENTS 1
MAXEXTENTS UNLIMITED
BUFFER_POOL DEFAULT
CREATE INDEX EMP_NAME_IX ON EMPLOYEES (LAST_NAME ASC, FIRST_NAME ASC)
LOGGING
TABLESPACE "USERS"
PCTFREE 10
INITRANS 2
STORAGE
INITIAL 65536
MINEXTENTS 1
MAXEXTENTS UNLIMITED
BUFFER_POOL DEFAULT
ALTER TABLE EMPLOYEES
ADD CONSTRAINT EMP_EMAIL_UK UNIQUE
EMAIL
USING INDEX
CREATE UNIQUE INDEX EMP_EMAIL_UK ON EMPLOYEES (EMAIL ASC)
LOGGING
TABLESPACE "USERS"
PCTFREE 10
INITRANS 2
STORAGE
INITIAL 65536
MINEXTENTS 1
MAXEXTENTS UNLIMITED
BUFFER_POOL DEFAULT
ENABLE;
ALTER TABLE DEPARTMENTS
ADD CONSTRAINT DEPT_LOC_FK FOREIGN KEY
LOCATION_ID
REFERENCES LOCATIONS
LOCATION_ID
ENABLE;
ALTER TABLE DEPARTMENTS
ADD CONSTRAINT DEPT_MGR_FK FOREIGN KEY
MANAGER_ID
REFERENCES EMPLOYEES
EMPLOYEE_ID
ENABLE;
ALTER TABLE EMPLOYEES
ADD CONSTRAINT EMP_DEPT_FK FOREIGN KEY
DEPARTMENT_ID
REFERENCES DEPARTMENTS
DEPARTMENT_ID
ENABLE;
ALTER TABLE EMPLOYEES
ADD CONSTRAINT EMP_JOB_FK FOREIGN KEY
JOB_ID
REFERENCES JOBS
JOB_ID
ENABLE;
ALTER TABLE EMPLOYEES
ADD CONSTRAINT EMP_MANAGER_FK FOREIGN KEY
MANAGER_ID
REFERENCES EMPLOYEES
EMPLOYEE_ID
ENABLE;
ALTER TABLE DEPARTMENTS
ADD CONSTRAINT DEPT_NAME_NN CHECK
(DEPARTMENT_NAME IS NOT NULL)
ENABLE;
ALTER TABLE EMPLOYEES
ADD CONSTRAINT EMP_EMAIL_NN CHECK
(EMAIL IS NOT NULL)
ENABLE;
ALTER TABLE EMPLOYEES
ADD CONSTRAINT EMP_HIRE_DATE_NN CHECK
(HIRE_DATE IS NOT NULL)
ENABLE;
ALTER TABLE EMPLOYEES
ADD CONSTRAINT EMP_JOB_NN CHECK
(JOB_ID IS NOT NULL)
ENABLE;
ALTER TABLE EMPLOYEES
ADD CONSTRAINT EMP_LAST_NAME_NN CHECK
(LAST_NAME IS NOT NULL)
ENABLE;
ALTER TABLE EMPLOYEES
ADD CONSTRAINT EMP_SALARY_MIN CHECK
(SALARY > 0)
ENABLE;
COMMENT ON TABLE DEPARTMENTS IS 'Departments table that shows details of departments where employees
work. Contains 27 rows; references with locations, employees, and job_history tables.';
COMMENT ON TABLE EMPLOYEES IS 'employees table. Contains 107 rows. References with departments,
jobs, job_history tables. Contains a self reference.';
COMMENT ON COLUMN DEPARTMENTS.DEPARTMENT_ID IS 'Primary key column of departments table.';
COMMENT ON COLUMN DEPARTMENTS.DEPARTMENT_NAME IS 'A not null column that shows name of a department. Administration,
Marketing, Purchasing, Human Resources, Shipping, IT, Executive, Public
Relations, Sales, Finance, and Accounting. ';
COMMENT ON COLUMN DEPARTMENTS.MANAGER_ID IS 'Manager_id of a department. Foreign key to employee_id column of employees table. The manager_id column of the employee table references this column.';
COMMENT ON COLUMN DEPARTMENTS.LOCATION_ID IS 'Location id where a department is located. Foreign key to location_id column of locations table.';
COMMENT ON COLUMN EMPLOYEES.EMPLOYEE_ID IS 'Primary key of employees table.';
COMMENT ON COLUMN EMPLOYEES.FIRST_NAME IS 'First name of the employee. A not null column.';
COMMENT ON COLUMN EMPLOYEES.LAST_NAME IS 'Last name of the employee. A not null column.';
COMMENT ON COLUMN EMPLOYEES.EMAIL IS 'Email id of the employee';
COMMENT ON COLUMN EMPLOYEES.PHONE_NUMBER IS 'Phone number of the employee; includes country code and area code';
COMMENT ON COLUMN EMPLOYEES.HIRE_DATE IS 'Date when the employee started on this job. A not null column.';
COMMENT ON COLUMN EMPLOYEES.JOB_ID IS 'Current job of the employee; foreign key to job_id column of the
jobs table. A not null column.';
COMMENT ON COLUMN EMPLOYEES.SALARY IS 'Monthly salary of the employee. Must be greater
than zero (enforced by constraint emp_salary_min)';
COMMENT ON COLUMN EMPLOYEES.COMMISSION_PCT IS 'Commission percentage of the employee; Only employees in sales
department elgible for commission percentage';
COMMENT ON COLUMN EMPLOYEES.MANAGER_ID IS 'Manager id of the employee; has same domain as manager_id in
departments table. Foreign key to employee_id column of employees table.
(useful for reflexive joins and CONNECT BY query)';
COMMENT ON COLUMN EMPLOYEES.DEPARTMENT_ID IS 'Department id where employee works; foreign key to department_id
column of the departments table'; -
Is this Join Query Syntax Correct???
Is this syntax correct for this query question? Would "used Vista cards" reflect the OrderDate Column in the where clause. The table is from Adventureworks2012.
How many Sales Orders (Headers) used Vista credit cards in October 2002
SELECT C.CardType, COUNT(*)
FROM Sales.SalesOrderHeader S
JOIN Sales.CreditCard
C
ON S.CreditCardID=c.CreditCardID
WHERE C.CardType = 'Vista'
AND S.OrderDate between '10/1/2002' and '10/31/2002'
GROUP BY c.CardType
That is correct, but be careful when writing queries where a datetime column is compared to a period of time. In this case it looks like the time portions of OrderDate are all set to the beginning of day (00:00:00.000) so your query works as long as
that assumption is correct. The better way is to use an upper boundary of the next day (which means you cannot use between). E.g.,
select ... where S.OrderDate >= '20021001' and S.OrderDate < '20021101'
group by ...
order by ...;
If you search for the forum for "Tibor" you should be able to find a link to his website where he goes into much more detail about the tricky usage of the datetime datatype. -
Please help me correct this syntax on a question from a practice book. I am using the Adventureworks 2012 Database .
Find the Territory Group, CountryRegionCode, Count of SalesHeaders in 2001, and the Count of SalesDetails in 2001
SELECT C.[Group], C.CountryRegionCode, COUNT(A.SalesOrderID), COUNT(B.SalesOrderID)
FROM [Sales].[SalesOrderHeader] A
INNER JOIN
[Sales].[SalesOrderDetail] B
ON A.SalesOrderID=B.SalesOrderID
INNER JOIN
[Sales].[SalesTerritory] C
ON C.[TerritoryID]=A.TerritoryID
WHERE DATEPART(YY,A.OrderDate) IN (2001)
GROUP BY
C.[Group], C.CountryRegionCodeHi,
There is no error and query works perfectly fine but there is not output coming because there is no data for 2001 qualify the criteria.
I checked this for 2007 and got the result as below.
Please let me know if your question was something different.
Thanks,
Nimit -
Whats the alternate for left join with using IN operator in the where claus
My senario...
Select t1.f1, t1.f2, t2.f3
From t1, t2
Where ...
t1.f1> (+) IN t2.f1
...alternate query..
Select t1.f1, t1.f2, t2.f3
From t1, t2
Where ...
(t1.f1> IN t2.f1 or 1=1)
...will the alternate query satisfy the above senario..?I'm not quite sure I've understood what the OP's question is, but will ANSI syntax deal with it?
SQL> ed
Wrote file afiedt.buf
1 with a as (select 1 as num, 2 as data from dual union all
2 select 2 as num, 3 as data from dual union all
3 select 3 as num, 4 as data from dual),
4 b as (select 1 as num, 5 as data from dual union all
5 select 3 as num, 7 as data from dual)
6 -- END OF TEST DATA
7 select a.num, a.data, b.data
8* from a LEFT OUTER JOIN b ON (a.num = b.num AND b.num IN (3))
SQL> /
NUM DATA DATA
3 4 7
1 2
2 3
SQL> -
how would i join a table to itself(i think it is call a recursive join) but the . The primary key for the table is compound i.e (ep_emp_id, ep_proj_id). The foreign key also consists of 2 columns i.e (ep_mgr_emp_id, ep_proj_id) The foreign key references on its own table. What would be the syntax to join the foreign key to the primary key? Its weird because there are two columns in each.
The schema is:
CREATE TABLE employee_on_project
ep_emp_id NUMBER(6) CONSTRAINT ep_emp_fk REFERENCES employee,
ep_proj_id NUMBER(5) CONSTRAINT ep_proj_fk REFERENCES project,
ep_hourly_rate NUMBER(5,2) CONSTRAINT ep_hourly_rate_nn NOT NULL,
ep_mgr_emp_id NUMBER(6),
CONSTRAINT ep_pk PRIMARY KEY(ep_emp_id, ep_proj_id),
CONSTRAINT ep_mgr_fk FOREIGN KEY (ep_mgr_emp_id, ep_proj_id) REFERENCES employee_on_project
e.g i know it isnt the usual
where a.id=b.b_id
thanks
Message was edited by:
user634445Hi,
Try this
select *
from employee_on_project eop, employee_on_project mop
where eop.ep_mgr_emp_id = mop.ep_emp_id
and eop.ep_proj_id = mop.ep_proj_id
[/pre
Regards -
ANY alternate for this???
Hi Experts,
Pls see the current method we are following for receiving overdelivery and suggest an alternate.
1) At material master the Base unit of Measure is "EA".
2) No alternate unit is maintained.
3) At PO Item level I feed in Oun = EA & OPU = KG. System asks the conversion factor between KG & EA. I enter 1 EA = 100 kg. check unlimited delivery and save.
4) At the time of GR I realise the goods that have come in weigh 105kgs/pc. Since I pay vendor in KGs I need to show that at MIGO by not increasing quantity. (wherein I can increase total weight since EA & KG are interlinked any increase in KG will also trigger EA)
5) Right now we are just amending the PO by changing 1 EA = 105 KGs and inwarding material.
6) Is there anyway I can keep my quantity STATIC and change Weight only at the time of MIGO?
Thanks & Regards,
Rajooyou can get what you want by so-called batch specific units of measure.
http://help.sap.com/saphelp_erp2005/helpdata/en/30/e1a993db3611d185160000e82013e8/frameset.htm -
Okay tried to play bejeweled on Facebook but it requires flash which I guess apple does not allow is there a way to do this?
Adobe owns flash.
Adobe does not make and is not making a flashplayer for iOS.
There is no work around.
If your whole purpose for buying an iPad was to play flash games, you are out of luck.
Return the iPad. -
create sequence myv ;
drop table t33;
create table t33
(c1 number default myv.nextval);Perhaps this, though the downside is it's rather more bulky than a generated number, and less human-readable:
SQL> create table t33
2 (c1 raw(16) default sys_guid(), c2 varchar2(30));
Table created.
SQL> insert into t33 (c2) values ('Banana');
1 row created.
SQL> select * from t33;
C1 C2
2571E04E2E3F59BFE040007F01001E0C Banana
1 row selected.
Maybe you are looking for
-
Creative Cloud Installer app verifies wrong e-mail address
I have CS3 on my computer that I purchased a while ago (directly through Adobe). I also have a CS6 version that my business partner purchased for me on his account. Yesterday when I signed up for an individual CC account I registered everything thro
-
Forecast Consumption in APO- No Data Available in Product View
Hi Experts I facing some problem in Forecast Consumption in APO. The APO system is connected to a R/3 system. So data relevant for Forecast consumption comes from R/3. The allocation indicator in the requirement class assigned to the strategy maintai
-
How to create a Log file on Client machine
Hi All, I am trying to create a log file on my local machine using TEXT_IO.FILE_TYPE in a stored procedure but it is throwing a compiler error as Error(5,10): PLS-00201: identifier 'TEXT_IO.FILE_TYPE' must be declared. I seem it is occuring because o
-
Hi Experts, (I will post this question in ABAP forums also) I am a new SAP FI consultant and am not sure of how to overcome the situation I encountered, while trying to print the IDOcs generated during the payment run. Without specifying any print v
-
Customizing look and feel of Rich Text Editor
I'm trying to remove the drop shadow from under the text area of the RichTextEditor. Both rteditor.filters and rteditor.textArea.filters are empty. Is the drop shadow actually applied to something else?