Gaurav Dhiman 2 Posted January 23, 2019 Posted January 23, 2019 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..!!
James Watts Posted January 25, 2019 Posted January 25, 2019 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)
Gaurav Dhiman 2 Posted January 28, 2019 Author Posted January 28, 2019 It worked..!! Actually it was much easier then I expected.. Thank You Jim for your help..
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now