473,320 Members | 1,982 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Three tables to one

EMW
Hi,

I have an Oracle database with different tables of data.
They all have one common field.
I need to combine some fields from three tables.
i.e.
field1 and field2 from table1
field3 and field4 from table2
field5 from table3

Alltogether I want to produce a dataset with one table with the following
schema: common, field1, field2, field3, field4, field5

How can I do this?
Can I do it by excecuting a SQL command to the database or do I combine the
data within the dataset or is there some other way of doing this?

My program is in VB.NET.

rg,
Eric
Jul 21 '05 #1
5 1278
The most efficient way, would be to do joins in your SQL query, so this is
all done at the database level.

"EMW" <so*****@MikroZoft.com> wrote in message
news:41**********************@dreader2.news.tiscal i.nl...
Hi,

I have an Oracle database with different tables of data.
They all have one common field.
I need to combine some fields from three tables.
i.e.
field1 and field2 from table1
field3 and field4 from table2
field5 from table3

Alltogether I want to produce a dataset with one table with the following
schema: common, field1, field2, field3, field4, field5

How can I do this?
Can I do it by excecuting a SQL command to the database or do I combine the data within the dataset or is there some other way of doing this?

My program is in VB.NET.

rg,
Eric

Jul 21 '05 #2
To expand, you can use a view to format the data appropriately and then all
the client has to do is select information from the view.

"Marina" <so*****@nospam.com> wrote in message
news:#3**************@TK2MSFTNGP09.phx.gbl...
The most efficient way, would be to do joins in your SQL query, so this is
all done at the database level.

"EMW" <so*****@MikroZoft.com> wrote in message
news:41**********************@dreader2.news.tiscal i.nl...
Hi,

I have an Oracle database with different tables of data.
They all have one common field.
I need to combine some fields from three tables.
i.e.
field1 and field2 from table1
field3 and field4 from table2
field5 from table3

Alltogether I want to produce a dataset with one table with the following schema: common, field1, field2, field3, field4, field5

How can I do this?
Can I do it by excecuting a SQL command to the database or do I combine

the
data within the dataset or is there some other way of doing this?

My program is in VB.NET.

rg,
Eric


Jul 21 '05 #3
EMW
could you give me an example?
I've searched for some examples on joining tables, but couldn't get it to
work.

rg,
Eric
"Marina" <so*****@nospam.com> schreef in bericht
news:%2****************@TK2MSFTNGP09.phx.gbl...
The most efficient way, would be to do joins in your SQL query, so this is
all done at the database level.

"EMW" <so*****@MikroZoft.com> wrote in message
news:41**********************@dreader2.news.tiscal i.nl...
Hi,

I have an Oracle database with different tables of data.
They all have one common field.
I need to combine some fields from three tables.
i.e.
field1 and field2 from table1
field3 and field4 from table2
field5 from table3

Alltogether I want to produce a dataset with one table with the following
schema: common, field1, field2, field3, field4, field5

How can I do this?
Can I do it by excecuting a SQL command to the database or do I combine

the
data within the dataset or is there some other way of doing this?

My program is in VB.NET.

rg,
Eric


Jul 21 '05 #4
"EMW" <so*****@MikroZoft.com> wrote:
could you give me an example?
I've searched for some examples on joining tables, but couldn't get it to
work.

rg,
Eric
Probably because you should have been looking for UNION
instead of JOIN, e.g.:

(
SELECT commonA, field1, field2,
'constA3', 'constA4', 'constA5'
FROM tableA WHERE ...
)UNION(
SELECT commonB, 'constB1', 'constB2',
field3, field4, 'constB5'
FROM tableB WHERE ...
)UNION(
SELECT commonC, 'constC1', 'constC2',
'constC3', 'constC4', field5
FROM tableC WHERE ...
);
you could use UNION ALL to preserve duplicates between
SELECTs - but I don't think that applies here.
Note that the column value's data types (or the "constant"
replacements) in each of the SELECT's column positions need
to be compatible.
"Marina" <so*****@nospam.com> schreef in bericht
news:%2****************@TK2MSFTNGP09.phx.gbl...
The most efficient way, would be to do joins in your SQL query, so this is
all done at the database level.

"EMW" <so*****@MikroZoft.com> wrote in message
news:41**********************@dreader2.news.tiscal i.nl...
Hi,

I have an Oracle database with different tables of data.
They all have one common field.
I need to combine some fields from three tables.
i.e.
field1 and field2 from table1
field3 and field4 from table2
field5 from table3

Alltogether I want to produce a dataset with one table with the following
schema: common, field1, field2, field3, field4, field5

How can I do this?
Can I do it by excecuting a SQL command to the database or do I combine

the
data within the dataset or is there some other way of doing this?

My program is in VB.NET.

rg,
Eric

'Any fool can write code that a computer can understand.
Good programmers write code that humans can understand.'
Martin Fowler,
'Refactoring: improving the design of existing code', p.15
Jul 21 '05 #5
I hate SQL so I always try too avoid it.

However being active in these newsgroups is every time learning more of it.

Eric, when this works, will you than answer that here, this can be a great
addition.

Cor
Jul 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Emilio | last post by:
Hello everyone. I hope someone can help me with this. I have 3 columns called EMPLOYEE_TEST, TEST_QA and EMPLOYEE_TEST_ANSWER. The TEST_QA table contains the following: TEST_QA_ID |...
1
by: NA | last post by:
Is it possible to have adjustable tables (not Access tables per se) but those in Ms Word or Excel based on nexted forms three deep? In other words, if I have a main form, Repair History, both the...
0
by: WindAndWaves | last post by:
Hi Gurus Here is another question that I have been struggling with for over a year. Basically, I would like to allow users to enter data into three tables in at the same time. The reason it...
7
by: RLN | last post by:
Re: Access 2000 I have three history tables. Each table contains 3 years worth of data. All three tables have a date field in them (and autonum field). Each table has the potential to contain...
11
by: MP | last post by:
context: (vb6 / ado / .mdb / jet4.0 / not using access) hypothetical problem say I need to track the properties of boxes. There are three kinds, cardboard, wood, and sheet metal. Each box...
3
by: BrianDH | last post by:
Hi I have a form with multi-tabs, and on each tab I have a one combo that has the same values. I populate all 3 combo with the same one datacall/dataset My problem is: when I make a value...
6
by: John | last post by:
Hi I have three tables with a common id with which they can be linked. I need to merge them in a way that the resultant table has all records from three tables. Below is what sort of result I am...
7
by: cov | last post by:
I have a php query where I'm attempting to pull data from 3 different tables between a php form and mysql db. I had hoped early on to use a unique identifier to help ensure referential integrity...
2
by: einsson | last post by:
I face a problem, please help. Error I hit when there are three combobox. Please refer the code with italic characters. this.comboBox1.DataSource = this.dataSet11.Tables;...
1
by: doc1355 | last post by:
I have a feeling that this is an easy question. However I'm a newbee and don't have any idea how to do this. I have three tables that stores my users information. Each user has a unique ID that is...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.