•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 361,942 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,677 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser:
Views: 847 | Replies: 5
![]() |
•
•
Join Date: Sep 2006
Posts: 104
Reputation:
Rep Power: 2
Solved Threads: 0
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,
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,
•
•
Join Date: Mar 2008
Posts: 115
Reputation:
Rep Power: 1
Solved Threads: 0
sql Syntax (Toggle Plain Text)
CREATE TABLE name1(name varchar) INSERT INTO name1 VALUES('A') INSERT INTO name1 VALUES('B') CREATE TABLE name2(name varchar) INSERT INTO name2 VALUES('B') INSERT INTO name2 VALUES('C') SELECT name FROM name1 UNION SELECT name FROM name2
UNION will eliminate duplicates,If u want to retain duplicates Use UNION ALL.
Is that worked for u?If face any probs reply.
Last edited by peter_budo : Apr 11th, 2008 at 6:47 pm. Reason: Keep It Organized - please use [code] tags
•
•
Join Date: Apr 2008
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
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
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
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
sql Syntax (Toggle Plain Text)
SELECT E.Last_Name, E.Sal, S.Category FROM Emp E, Salary S WHERE E.Sal BETWEEN S.Highest AND S.Lowest
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
Last edited by peter_budo : Apr 17th, 2008 at 1:53 pm. Reason: Keep It Organized - please use [code] tags
•
•
Join Date: Apr 2008
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
SQL Syntax (Toggle Plain Text)
SELECT * FROM Employees
I posted this message to learn the [code tags]
Last edited by aardvax01 : Apr 18th, 2008 at 7:14 am.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb MS SQL Marketplace
•
•
•
•
ad ad server ad serving advertising ajax architecture asp backup beta business centro crash daniweb database dell developer development doubleclick enterprise google gpt guid partition table hacker hyper-v internet linux longhorn mail management studio 2005 microsoft mmorpg msdn news novell office open partition qmail red hat rhel security server server 2008 smtp software sql survey vista vmware windows
- Previous Thread: Info needed regarding SQL server 2005
- Next Thread: Error Code 424: object required


Linear Mode