473,386 Members | 1,779 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,386 software developers and data experts.

Merge 2 tables with conditions

peeaurjee
Hi!

I have 2 tables:


Table Users:
ID
Name
Password
Birth


Table Status:
ID
Status


Both tables are related by "ID" field, but both tables have not the
same number of elements


I want to obtain a new table with this structure:


Table Result:
ID
Name
Password
Birth
Status


As I said before both tables have not the same number of elements
(rows) so in my result table, "Status" field should be empty for those
"ID"'s not found in "Status" table.


Example:


Users: 1 2 3
John Mary Peter
1234 3333 3456
5/11/81 9/3/80 7/7/69


Staus: 1 3
CODE1 CODE5


Result: 1 2 3
John Mary Peter
1234 3333 3456
5/11/81 9/3/80 7/7/69
CODE1 (EMPTY) CODE5


Thanks in advance.
Nov 6 '07 #1
3 976
Rabbit
12,516 Expert Mod 8TB
Do an outer join, either left or right depending on the placement of the tables.
Nov 6 '07 #2
Can you please make your answer a little brief ? Thank You
Do an outer join, either left or right depending on the placement of the tables.
Nov 7 '07 #3
Rabbit
12,516 Expert Mod 8TB
Can you please make your answer a little brief ? Thank You
I can't tell if you're being sarcastic or just that you're not fluent in english. Did you want me to go into detail?
Nov 7 '07 #4

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

Similar topics

8
by: Nils | last post by:
Hello, my problem: I merged about 1.000 Tables with Create table name (variables) type=merge union=(table1,table2,...,table1000); MySQL now creates a tables, but I can't open it....
1
by: Bob Stearns | last post by:
Does the following message get generated before or after the additional conditions given in the merge are evaluated? Error: The same row of target table "NULLID.AICA" was identified more than...
11
by: UDBDBA | last post by:
Hi: This is a merge questions which has been posted and answered... in my case need more clairification when target table (tableB) matched multiple rows to be updated based on the ON condition...
3
by: cdelarte | last post by:
I would like to be able to mail merge records from multiple mysql tables using a simple template, preferably via a command line script. MSWord mail merge via ODBC will not work for me as it only...
16
by: UDBDBA | last post by:
Hi All: I need some clarification on a MERGE statement. The database is on V8 FP12 (AIX) 64bit. The source table is tableA. The target is a View "FACT" with UNION ALL because of the 512 Gig...
3
by: opeca | last post by:
Hi all, I have two tables(A, B), and I would like to attach records from these ones. Only I have two conditions, else i can use UNION. 1. Condition: If the value in col2 in A table is in...
7
by: giladp1 | last post by:
I found Albert Kallal's great "Super easy Word Merge" code in his site at: http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html Thanks Albert so much for sharing this. I am looking...
0
by: Dave.Womer | last post by:
All, I'm having an issue merging datasets. It seems everytime I peform a merge of new data on existing data all of the rows of the existing data are modified even if the new data does not...
2
by: Vicente | last post by:
Hi! I have 2 tables: Table Users: ID Name Password Birth
1
by: joproulx | last post by:
Hello all, Here is my problem: I am trying to merge 2 datasets but I don't want to overwrite rows that are already modified in my working dataset. Example: I have one Dataset with only one...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
jinu1996
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...

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.