473,881 Members | 1,755 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create query columns from similar rows

22 New Member
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 8285
462 Recognized Expert Moderator Contributor
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
32,584 Recognized Expert Moderator MVP
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

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

Similar topics

by: helpful sql | last post by:
Hi all, I am using an HTML table control on my ASP.Net page. Now I need to change this table so that columns become rows and rows become column. Since the table is very complex with many controls in them, I am wondering if there is any way to do this in visual studio 2003 or using any other tool. Thanks in advance.
by: Sergiu Cojocaru | last post by:
Ia have a query that returns a variable number of columns. How can I create these columns in Crystal?
by: helpful sql | last post by:
Hi all, I am using an HTML table control on my ASP.Net page. Now I need to change this table so that columns become rows and rows become column. Since the table is very complex with many controls in them, I am wondering if there is any way to do this in visual studio 2003 or using any other tool. Thanks in advance.
by: Anand | last post by:
Greetings, How can I find the number of active columns and rows used in an excel work sheet? What I mean is how can i find the last column and row or cell position, where the data is stored in an excel sheet? A code snippet would be of great help. Thanks for your cooperation and help.
by: vinod | last post by:
hi experts, is it possible to view a table rows as columns and columns as rows? thnnk you in advance
Vasuki Masilamani
by: Vasuki Masilamani | last post by:
Hi, I need a query which would convert Columns into Rows without causing any damages to the original data. I am not supposed to solve this by creating temporary tables and later dropping it. I have a table which is in the below format: Name EmployeeID Year JanExp FebExp MarExp JanHrs FebHrs MarHrs A 129178 2005 10 20 30 15 25 35 B 129213 2004 40 ...
by: Shivakumar | last post by:
Dear Friends, I want to show columns into rows. For example, I have a table, TIMESHEET, with the following structure: CREATE TABLE TIMESHEET ( EMPNO CHAR(3), WEEKEND_DATE DATE, SAT SMALLINT,
by: muhammadrashidmughal | last post by:
columns f1 f2 f2 f4 f5 f6 f7 f8 ...... 1 2 3 4 . . i have a table in which multiple columns and records more than 1000 , i need a query to convert these records in columns and columns in rows.
by: Yaridovich | last post by:
Hello everyone, I'm trying to come up with a query that removes rows where a certain column has the same value (for instance, the column's value is the same in rows #503, #677 and #1020). There are two catches: - I can't specify the value (or values) to be checked for repetition, the query has to check for any repeated value; - I can't also specify the number of repetitions, the minimum is 2 but there's no maximum. I want to remove all...
by: ricky | last post by:
Hi, I have some procedures with dynamic sql(generic procedure for different tables) to do the convert columns to rows but have performance issue. Is there a better way like a single SQL that can solve my problem, thanks!!! Table A(total 20 columns) Col1 Col2 Col3 Col4 ... Col20 Table B(total 10 columns) Col1 Col2 Col3 Col4... Col10
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.