Solved

sql two tables

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

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

Thanks!

0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 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

22 Experts available now in Live!

Get 1:1 Help Now