Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

sql two tables

Posted on 2011-09-08
3
Medium Priority
?
216 Views
Last Modified: 2012-05-12
Hey guys i have this sql query:

select DISTINCT UPPER(r_name) as r_name, UPPER(address) as address, area, location, p_code, tel, website, '<b>'+ UPPER(r_name) + '</b>' + '<br>' + UPPER(address) + '<br>' + area + '<br>' + IsNull(location,'') +  '<br> CONTACT: ' + tel  as InfoWindowText, Latitude as Lat, Longitude as Lng FROM dbo.ballito where active='Yes'";

now i want to select the same data but two tables.

the coloums are the same
0
Comment
Question by:JCWEBHOST
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 10

Assisted Solution

by:Umar Topia
Umar Topia earned 664 total points
ID: 36501508
select DISTINCT UPPER(tblBalito.r_name) as r_name, UPPER(tblBalito.address) as address, tblBalito.area, tblBalito.location, tblBalito.p_code, tblBalito.tel, tblBalito.website, '<b>'+ UPPER(tblBalito.r_name) + '</b>' + '<br>' + UPPER(tblBalito.address) + '<br>' + tblBalito.area + '<br>' + IsNull(tblBalito.location,'') +  '<br> CONTACT: ' + tblBalito.tel  as InfoWindowText, tblBalito.Latitude as Lat, tblBalito.Longitude as Lng FROM dbo.ballito as tblBalito, dbo.balito2 as tblbalito2 where tblBalito.active='Yes'";
0
 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 668 total points
ID: 36501521
dis you mean to say you want to combin ata from two table in one result set

try this .Table2 to yourtablename

select DISTINCT UPPER(r_name) as r_name, UPPER(address) as address, area, location, p_code, tel, website, '<b>'+ UPPER(r_name) + '</b>' + '<br>' + UPPER(address) + '<br>' + area + '<br>' + IsNull(location,'') +  '<br> CONTACT: ' + tel  as InfoWindowText, Latitude as Lat, Longitude as Lng FROM dbo.ballito where active='Yes'";

Union

select DISTINCT UPPER(r_name) as r_name, UPPER(address) as address, area, location, p_code, tel, website, '<b>'+ UPPER(r_name) + '</b>' + '<br>' + UPPER(address) + '<br>' + area + '<br>' + IsNull(location,'') +  '<br> CONTACT: ' + tel  as InfoWindowText, Latitude as Lat, Longitude as Lng FROM dbo.Table2 where active='Yes'";
0
 
LVL 15

Assisted Solution

by:Navneet
Navneet earned 668 total points
ID: 36501530
Hi!

SELECT table1.column1, table2.column2
FROM table1, table2
WHERE table1.column1 = table2.column1;

Thanks!

0

Featured Post

DFW AZURE MEETUP TONIGHT FRI 6PM

We will be discussing what Azure Stack is, how does it fit into the suit of offerings that Azure has currently, and where can it fit into your organizations technology stack. We will also be discussing limitations of the platform while covering various applicable scenarios.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question