Records on the basis of two different tables.
-
Suppose I have two tables (Emp and EmpCopy) in sql server database with following data: Case 1: Data in Emp and EmpCopy table present like below: Table: Emp Id Name ---------------------- 1 Emp_Name 2 Emp_Age 3 Emp_City Table: EmpCopy Id Name -------------------- 1 Emp_Name 2 Emp_Age Case 2: Data in Emp and EmpCopy table present like below: Table: Emp Id Name -------------------- 1 Emp_Name 2 Emp_Age Table: EmpCopy Id Name --------------------- 1 Emp_Name 2 Emp_Age 3 Emp_City Now according to cases given above I want retrieve records from both the tables, just like given below Case 1: Id Emp_Column EmpCopy_Column 1 Emp_Name Emp_Name 2 Emp_Age Emp_Age 3 Emp_City NULL Case 2: Id Emp_Column EmpCopy_Column 1 Emp_Name Emp_Name 2 Emp_Age Emp_Age 3 NULL Emp_City Please reply ASAP. Thanks in advance.
-
Suppose I have two tables (Emp and EmpCopy) in sql server database with following data: Case 1: Data in Emp and EmpCopy table present like below: Table: Emp Id Name ---------------------- 1 Emp_Name 2 Emp_Age 3 Emp_City Table: EmpCopy Id Name -------------------- 1 Emp_Name 2 Emp_Age Case 2: Data in Emp and EmpCopy table present like below: Table: Emp Id Name -------------------- 1 Emp_Name 2 Emp_Age Table: EmpCopy Id Name --------------------- 1 Emp_Name 2 Emp_Age 3 Emp_City Now according to cases given above I want retrieve records from both the tables, just like given below Case 1: Id Emp_Column EmpCopy_Column 1 Emp_Name Emp_Name 2 Emp_Age Emp_Age 3 Emp_City NULL Case 2: Id Emp_Column EmpCopy_Column 1 Emp_Name Emp_Name 2 Emp_Age Emp_Age 3 NULL Emp_City Please reply ASAP. Thanks in advance.
Suppose you had a script that created those tables, and inserted some data in it; wouldn't that cost about just as much time as writing all those fields like that? The advantage of a script would be that it's clearly to read, easy to see what is going on, easily validated using copy/paste, and you'd probably get more (usefull) answers - simply because more people tend to paste a piece of Sql and try it, than to read a long story.
Rohit Kesharwani wrote:
Please reply ASAP.
If your boss planned in too little time to research, than that's HIS problem. Not mine, not yours. To prove that point, I'll be fetching some coffee. I suggest you post your code in
PRE
tags, including one or two queries that you already tried. They needn't be good, we're not going to whine about it; it's just a good idea to have "proof" you tried something.Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]
-
Suppose you had a script that created those tables, and inserted some data in it; wouldn't that cost about just as much time as writing all those fields like that? The advantage of a script would be that it's clearly to read, easy to see what is going on, easily validated using copy/paste, and you'd probably get more (usefull) answers - simply because more people tend to paste a piece of Sql and try it, than to read a long story.
Rohit Kesharwani wrote:
Please reply ASAP.
If your boss planned in too little time to research, than that's HIS problem. Not mine, not yours. To prove that point, I'll be fetching some coffee. I suggest you post your code in
PRE
tags, including one or two queries that you already tried. They needn't be good, we're not going to whine about it; it's just a good idea to have "proof" you tried something.Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]
Eddy Vluggen wrote:
To prove that point, I'll be fetching some coffee. I suggest you post your code in
PRE
tags, including one or two queries that you already tried. They needn't be good, we're not going to whine about it; it's just a good idea to have "proof" you tried something.+5 purely for that!
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch