Jump to content

Recommended Posts

Posted

I am trying to select data from an existing data table to a new data table , but i'm not sure how can i do this. In Access/SQL, it is quite easy. Here is the code in SQL:

SELECT orderdata.[Order_number], orderdata.[item], Max(orderdata.Loc) AS SL, Max(orderdata.[Confirmed Qty]) AS [Confirmed Qty], Max([M_Date])) AS [Confirmed M_Date], orderdata.T-flag, orderdata.[Top Mat], orderdata.[MLoc], orderdata.Av FROM orderdata GROUP BY orderdata.[Order_number], orderdata.[item], orderdata.T-flag, orderdata.[Top Mat], orderdata.[MLoc], orderdata.Av HAVING (((Max(orderdata.[Confirmed Qty]))>=1) AND ((orderdata.T-flag)-1) AND ((orderdata.[MLoc])-1));

Is it possible to run same code or there is some other way of doing this Thanks in Advance..!!

Posted

I would do it in steps.

Create a calculated column that has a value of one if it meets the criteria you specified, and zero otherwise.

Create a table with one column and one row, having a value of 1.

INSERT COLUMNS into the new small table from your data, matching on the only column in the small table and the new calculated column in your data table.

(I have seen examples where a data function is used to filter the output, but the above method is much faster with large data sets)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...