cancel
Showing results for 
Search instead for 
Did you mean: 

Help With BOM Query

RahF
Participant
0 Kudos

Hello Experts

I have written a query, doesn't do what I need it to do

So need some help fixing it

When the query is run, what I need the query to display is

Stock Code,

Description,

Date the Stock Code was created.

User name of the person who created the BOM,

Date the stock code was last modified,

Name of the person who last modified it

SELECT 
T0.[Code] as 'Stock Code', 
T0.[U_BOM_Desc], 
T0.[CreateDate] as 'Date BOM Created', 
T1.[U_NAME] as 'BOM Created By', 
T0.[UpdateDate] as 'Date BOM Updated', 
T0.[UserSign2] as 'BOM Updated By' 
FROM OITT T0  INNER
JOIN OUSR T1 ON T0.[UserSign2] = T1.[USERID] 
WHERE 
T0.[CreateDate] =[%0] AND 
T0.[CreateDate] =[%1] 
GROUP BY 
T0.[Code], 
T0.[U_BOM_Desc], 
T0.[CreateDate], 
T1.[U_NAME], 
T0.[UpdateDate], 
T0.[UserSign2]

Can someone please help and guide me and tell me where i am going wrong

Thank You

Regards

Rahul

Accepted Solutions (1)

Accepted Solutions (1)

former_member185682
Active Contributor

Hi Rahul,

This should do the work.

SELECT 
	T0.Code AS 'Stock Code',
	T1.ItemName AS 'BOM Desc', 
	T0.CreateDate as 'Date BOM Created', 
	T2.U_NAME as 'BOM Created By', 
	T0.UpdateDate as 'Date BOM Updated', 
	T3.U_NAME as 'BOM Updated By' 
FROM 
	OITT T0 
	INNER JOIN OITM T1 ON T1.ItemCode = T0.Code
	INNER JOIN OUSR T2 ON T2.USERID = T0.UserSign
	LEFT JOIN OUSR T3 ON T3.USERID = T0.UserSign2
WHERE 
  T0.CreateDate BETWEEN [%0] AND [%1]

Kind Regards,

Diego Lother

RahF
Participant
0 Kudos

Hi Diego

Thanks for that. It works just how I wanted

Now I need to decifer how you did it, so I can learn and wont have to ask next time

Thanks a lot

Much appreciated

Regards

Rahul

Answers (2)

Answers (2)

RahF
Participant
0 Kudos

Hi Nagarajan

The standard Change log function can check only one stock code at a time

With the query

I can find out by date range. How many stock codes were created? Created by whom? How many were modified? Modified by whom?

Yes please I need the query

Thanks

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi,

Have you tried with standard "Change log" function for history?

Let me know still you need query.

Thanks