471,853 Members | 1,869 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,853 software developers and data experts.

Create query columns from similar rows

22
Hi - thanks for the read ! I have seen many examples of this but I cannot get it to work for me!
I hoped that if I plugged in my data someone could shed some light!
I have a table that is recording shipment data for an order. An order ships, we need to capture that in three fields with an autonumber ID, like this:
GRID OrderNo(LI Number) ShipDate(Date) GRNo(Short Text)
1 51056 7/13/2021 SG20210609001
2 51056 7/13/2021 SG20210609002
3 51239 9/4/2021 SG-20210904002
4 51239 9/10/2021 SG-20210910001
5 51057 5/26/2021 SG-20210526003

The variables for these records are single date and GRNo per order, mulitple GRNo per order with same date, or multiple GRNo with different dates , and I'm looking to retrieve the info like this:
OrderNo ShipDate GRNo SD2 GR2
51056 7/13/2021 SG20210609001 7/13/2021 SG20210609002
51239 9/4/2021 SG-20210904002 9/10/2021 SG-20210910001
51057 5/26/2021 SG-20210526003

Thank you and love to anyone that can teach me how to write this Query!
Sep 14 '21 #1
2 8084
isladogs
404 Expert Mod 256MB
Sounds like you need a subquery.
Have a look at the Get the value in another record example in Allen Browne's article on subqueries: http://allenbrowne.com/subquery-01.html#AnotherRecord
Sep 14 '21 #2
NeoPa
32,462 Expert Mod 16PB
Your example doesn't make it clear what you want from this. Are you looking for a list of all items that match on [OrderNo] or just the Min() & Max() range of them?
Sep 21 '21 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by helpful sql | last post: by
1 post views Thread by Sergiu Cojocaru | last post: by
reply views Thread by helpful sql | last post: by
5 posts views Thread by Anand | last post: by
3 posts views Thread by Shivakumar | last post: by
NeoPa
reply views Thread by NeoPa | last post: by
aboka
reply views Thread by aboka | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.