Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 how to write query?

Author  Topic 

samsun125
Yak Posting Veteran

63 Posts

Posted - 2009-01-08 : 08:51:00
Hi all,

i have 3 tables
1.companies columns are companyid(p.k),companyname
2.companycountrymappings columns are rowid(P.K),
companyid(F.K),countryid(F.K)
1.locationscolumns are countryid(P.K),countryname

what i want to do is i want to get companyid,companyname based on country.

i want to write query without using joins,subqueries & views.
any other option ,my requirement is like this

If anybody knows please help me

Thanks & Regards
Rama



elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2009-01-08 : 08:55:00
without using joins?? are you sure that's your requirement?

Em
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-01-08 : 08:57:23
Let him use IN or EXISTS instead.
If he wants to go have some coffee or tea while query is running, it's his choice.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

samsun125
Yak Posting Veteran

63 Posts

Posted - 2009-01-08 : 09:01:11
yes they don't joins,subqueries,views.

they are telling using the above features it will hit the performance.

please help me on this
Go to Top of Page

raky
Aged Yak Warrior

767 Posts

Posted - 2009-01-08 : 09:03:30
select cp.companyid,cp.companyname
from companies cp,companycountrymappings ccm ,locationscolumns lc
where cp.companyid = ccm.companyid and ccm.countryid = lc.countryid and lc.countryname = 'yourcountry'
Go to Top of Page

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2009-01-08 : 09:06:49
raky... i think you'll find that's a join dude

Em
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-01-08 : 09:09:14
Raky may be right in this particular scenario.
Maybe OP got an "browser" of his own that do not accept "JOIN" keyword?



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -