Solved

sql two tables

Posted on 2011-09-08
3
215 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 166 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 167 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 167 total points
ID: 36501530
Hi!

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

Thanks!

0

Featured Post

Stack Overflow Podcast - Frustrating Miracles

In this podcast, Stack Overflow interviewed Linux Academy CEO/Founder, Anthony James, and got his developer story!

"Follow your passion, be prepared to work hard and sacrifice, and, above all, don't let anyone limit your dreams."  - Donovan Bailey

Question has a verified solution.

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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

630 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