Solved

sql two tables

Posted on 2011-09-08
3
208 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
3 Comments
 
LVL 10

Assisted Solution

by:Umar Topia
Umar Topia earned 166 total points
Comment Utility
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
Comment Utility
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:navneethegde
navneethegde earned 167 total points
Comment Utility
Hi!

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

Thanks!

0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now