Thanks in advance to all who read this.
I've got 3 tables which were created from a txt file dumped from some
old system.
Header
ID -- autonumber, primary
OrderNum -- field I want
Line
ID -- may be none, may be many
OrderNumSub -- field I want
Option
ID -- may be none, may be many
OrderNumOpt -- field I want
What I need is OrderNum, OrderNumSub, and OrderNumOpt all put into a
single column AllOrders.
Any advice would be appreciated,
Derek 6 1261
Is this a true statement:
One Header can have many Lines. One Line can have many Options.
or is it...
One Header can have many Lines. One Header can have many Options.
Also, please provide the Foreign Key fields in the downstream tables.
Assuming the first statement is correct and making up a foreign key
field, the query would be:
SELECT Header.OrderNum, Line.OrderNumSub, Option.OrderNumOpt FROM
(Header INNER JOIN Line ON Header.ID = Line.fkHeaderID) INNER JOIN
[Option] ON Line.ID = Option.fkLineID;
The fields prefixed "fk" are the foreign keys I ask for above. I
created a blank database to test the query. Let me know if you want it
and I'll email it to you.
Thanks,
Johnny
Your first guess was correct. One Header can have many Line. Each
Line can have many Options.
If you could send the sample DB you spoke of to De*********@gmail.com
I'd like to take a look at it.
Thanks Johnny,
Derek
Ciula --- is the last part of the email
The email address is truncated. Please send an email to the following
address:
j[DELETETHISTEXT}meredith AT gee MAIL dot COM (THIS IS A GMAIL ADDRESS)
and I will reply with it as an attachment.
Johnny
pointBoarder wrote: Thanks in advance to all who read this.
I've got 3 tables which were created from a txt file dumped from some old system.
Header ID -- autonumber, primary OrderNum -- field I want
Line ID -- may be none, may be many OrderNumSub -- field I want
Option ID -- may be none, may be many OrderNumOpt -- field I want
What I need is OrderNum, OrderNumSub, and OrderNumOpt all put into a single column AllOrders.
Any advice would be appreciated, Derek
Since you want a single field, your best bet is a Union query. After
that, another query to get a field. Air code
Select ID, OrderNum As DisplayIT, 1 As Priority From Header
UNION ALL
Select ID, OrderNumSub As DisplayIT, 2 As Priority From Line
UNION ALL
Select ID, OrderNumOpt As DisplayIT, 3 As Priority From Option
Call this Query1
Now create another query.
Select DisplayIT from Query1 Order By ID, Priority This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bung |
last post by:
Hi,
I have a tricky sql statment I have to write (tricky for me) and I am
stuck. I'm having trouble with the following problem.
Table1 (Column a, Column b, Column c)
Table2 (Column a, Column b, Column c)
Table3 (Column a, Column b, Column c)
Table1 contains a row of value (1, 2, 3)
|
by: Angel Cat |
last post by:
I have 2 tables joined together by the IDs, People and the pets they
own
PEOPLE
ID NAME
1 JohnSMith
2 JaneDoe
PETS
ID PET
|
by: Novice |
last post by:
Hey all, I've attempted to simplify my question (or at least the XML
that is part of my example in my question):
I have the following XML:
<A>
<B><C><D>
I want to query the data in this node for the element B
</D></C><E>
I also want to query the data in this node for the element B
</E>
|
by: PST |
last post by:
Here's a problem I'm trying to deal with:
I'm working on a Frontpage 2000 website for a boat handicapping
system, built in Access 97.
What I'm trying to accomplish is:
The user enters a boat name in a text field OR a sail number in a text
field, and gets the desired boat record back (an exact match).
|
by: Johnny Ljunggren |
last post by:
Hello all
I've got this tricky situation that I would like to solve in SQL, but
don't know how to do. This is the table:
Id = 3, VId = 2, Time1 = 10:00, Time2 = 14:00
Id = 4, VId = 2, Time1 = 16:00, Time2 = 17:00
Id = 5, VId = 2, Time1 = 18:00, Time2 = 19:00
Id = 6, VId = 2, Time1 = 20:00, Time2 = 21:00
Id = 7, VId = 3, Time1 = 11:00,...
| |
by: annecarterfredi |
last post by:
query the syscat.columns table and prepare SELECT statement (SELECT
all_columns FROM table_name). For example, let's say that TAB_1 table
has total of three columns, and the statement should be:
SELECT COL1, COL2, COL3 FROM TABSCHEMA.TAB_1
for all tables in syscat.columns
I am not able to comeup with that query...need help...Thanks.
|
by: MorrganMail |
last post by:
Or at least I find it tricky. :-)
Assume we have three tables A, B and C. Table A contains a path and the
distance for traveling that path:
A (PathId, NodeId, Dist (from previous node))
1, 1, 0
1, 2, 10
1, 3, 5
|
by: cephal0n |
last post by:
Hi All!
First of I apologize for my previews post needing help on union select and not providing so more explanation, but thank you very much for your opinion and sugestion. I have thought about my problem and try to find a solution. I now have few answres and would like to ask for your expertise on how I handled my sql.
I made an sql code, I...
|
by: KevLe |
last post by:
I'm building a log search function in c# for a certain management app and would like some help on the design how to solve
this, here is my solution (on paper) so far:
The log files are saved to disk, one file per date and one row "per logged event". Each row has a specific logged time
(within the file's date) with different keys and values. ...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
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...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
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...
|
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...
|
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: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |