| Author |
Topic |
|
ronalberts
Starting Member
2 Posts |
Posted - 2004-01-27 : 03:29:05
|
I need to know wheter it is possible to join to files together to a (temporary) file. File A contains a field NUMBER and several fields containing Name, Adres, etc. File B contains also a field NUMBER and a field with AMOUNT.Now, we would like to join these two files to one new file that contains all the fields from file A but additional the field AMOUNT where the field NUMBER mact on both files.Can this be done by using SQL ? Looking forward to some help ! Note: We use SQL on an IBM iseries system.Kind regards,Ron |
|
|
rihardh
Constraint Violating Yak Guru
307 Posts |
Posted - 2004-01-27 : 04:04:43
|
| What do you mean by "file"? And be carefull with the use of "joint". |
 |
|
|
ronalberts
Starting Member
2 Posts |
Posted - 2004-01-27 : 04:42:54
|
| By file I mean a file containing records.example:File ClientContaining record custnbr, name, adres, telnbr, etc.Note: this is on an IBM iseries, not a PC file but I don´t think that´s an issue. SQL is mostly the same. |
 |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2004-01-27 : 05:33:31
|
| You need to get your terminology/technology right 1st.This site is primarily orientated towards MicroSoft SQL Server.Tables....not files...files here are things that can be opened in Notepad, Excel + MS Word.Search here and BOL (Books Online - comes with MS SQL)....for "inner join" and "left join"...you'll see plenty of examples that may help you along your way.Your description is also a bit brief....usually we'd like to see the definition of both tables, some sample input data and some sample expected results....what advice we offer is free, however it does help to help us AS MUCH as possible. |
 |
|
|
rihardh
Constraint Violating Yak Guru
307 Posts |
Posted - 2004-01-28 : 03:35:34
|
| We all have seen a server, thank you. It's that big black box standing in a corner and giving us lots of headache.What kind of OS does it run on and what kind of DB holds your data? |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-01-28 : 12:22:01
|
| You can concatenate files together using the type command in DOS. For instance:type *.* > C:\temp\concat.txtThe above command will concatenate all files in the current directory into a file called concat.txt in the temp directory. To do it in SQL, just use xp_cmdshell with the type command.But I think you are looking for JOIN:SELECT a.Column1, b.ColumnAFROM Table1 t1INNER JOIN Table2 t2 ON t1.Column1 = t2.Column1WHERE a.Column2 IS NOT NULLTara |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2004-01-28 : 13:03:20
|
| Or if he is looking for a joint, it'll make merging the file that mcu harder..."wow look at all the colors..."Brett8-) |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2004-01-28 : 13:05:46
|
| Sorry....Dude! What does it mean when you say you're running on IBM machine?What type of prodcucts do you have installed?Brett8-) |
 |
|
|
setbasedisthetruepath
Used SQL Salesman
992 Posts |
Posted - 2004-01-28 : 14:42:01
|
| His use of the word "file" when referring to a database table, plus running on IBM hardware, leads me to guess he is referring to ..... an AS/400 system.JonathanGaming will never be the same |
 |
|
|
|