![]() |
| ||
| Extract columns from two independent table in SQL Server 2005? I want to get two columns data from two tables which are not dependent to each other i.e. no key common in both they are not related to each other. I can't use JOIN because it needs where clause which uses a common field from both tables. I just want one column from one table and one column from another and display it. how can do it? some unions or any other syntax for that? Thanks in advance, |
| ||
| Re: Extract columns from two independent table in SQL Server 2005? select * from table1, table2 this combines both tables |
| ||
| Re: Extract columns from two independent table in SQL Server 2005? create table name1(name varchar) UNION will eliminate duplicates,If u want to retain duplicates Use UNION ALL. Is that worked for u?If face any probs reply. |
| ||
| Re: Extract columns from two independent table in SQL Server 2005? Can u Paste the tables & specify which column to retrieve, so that I can help u out. |
| ||
| Re: Extract columns from two independent table in SQL Server 2005? Hi Bhavna I think that you can do it yourself There is something called Non -Equi Joins Which needs the where clause which you want I think you can use Logical Operators to accomplish what you want There is one Example of Employee and Salary Tables ( a famous one) Hope this will help you Ok lemme give an Example -- Suppose there are two tables with name as Emp and Salary SELECT E.Last_Name, E.Sal, S.Category And this example is taking oracle in consideration .. there might be some other way of using joins in SQL Server I will have a look and will edit this post once more |
| ||
| Re: Extract columns from two independent table in SQL Server 2005? SELECT * FROM Employees I posted this message to learn the [code tags] |
| All times are GMT -4. The time now is 10:44 pm. |
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC