Hello Guys,
I am trying to get the data from two columns of two different tables using Join as combining them as a whole to insert into dropdownlist...
The situation is like this:
There are two tables named tblPropertyCategory and tblPropertySubCategory.. I have PCName in tblPropertyCategory and
PSCName in tblPropertySubCategory.. I want to get the data of both PCName and PSCName and display into my dropdownlist...
What I have tried so far is like this:
select PCName,PSCNAME
from tblPropertyCategory INNER JOIN tblPropertySubCategory
ON tblPropertyCategory.PCId=tblPropertySubCategory.PCId
and I am getting result like this:
http://s19.postimage.org/xz7beuwk3/img1.jpg
and when i am using :
select (PCName+'-'+PSCNAME) as PC
from tblPropertyCategory INNER JOIN tblPropertySubCategory
ON tblPropertyCategory.PCId=tblPropertySubCategory.PCId
I am getting output like this:
http://s19.postimage.org/utmpondxv/img2.jpg
I want my output like this:
All Residential
All Commercial
Plot
Builder Apartment
Multi Storey Apartment
Bungalow / Villa / Pent House
Paying Guest / Hostel
Land (Commercial)
Office Space
Shop / Showroom
Guest House
Business Center
Industrial Building
Industrial Land
ie, Every Data from both the table should be combined which can be used to enter into the dropdownlist.
Nyhow Is it possible to use Union without revoking the Join property of these two table ie, I am getting the above result by using:
select PCName from tblPropertyCategory
union
select PSCName from tblPropertySubCategory
My Question is will it be valid ie, Is the Primary Key and Foreign Key functionality will be maintained..
coz I want to enter data using these values so have to write stored procedure accordingly but
in the above case I am not using PCId which is primary key for tblPropertyCategory and foreign Key for
tblPropertySubCategory which is not used in the above query...
Regards and Thanx in Advance..