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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 joins or subquery?

Author  Topic 

yipchunyu
Yak Posting Veteran

80 Posts

Posted - 2002-06-16 : 22:01:07
Hi guys,

I got a problem need your kindly help

I got two tables. 1 is code description like

info_type     code    desp
plan     A     product A
plan     B     product B
status     A     Auto-pay


and the second tables contain the record i use

record     plan     status
0001    A     A
0002     A     B
0003     B     A

I want to return the result as

0001     A-Product A     A-Auto-pay


Presently, i created two views for code description which 1 is for the product's description and the other one is status' description.
And then I join the table and the two views together.

I know it's stupid but I don't know any better means to do so.
Any suggestions? Any performance implication/impact if i decided to use subquery (if possible) or the joins?





fisherman_jake
Slave to the Almighty Yak

159 Posts

Posted - 2002-06-18 : 03:28:12
YIP,

Nothing wrong with views (even the Guru Ken Henderson does not oppose them). Just make sure that the underlying queries that make up your views are as efficient as they can be!!

Happy Coding..

==================================================
Do not argue with IDIOTS. They will take you down to their level and BEAT you with experience.
Master Fisherman
Go to Top of Page

yipchunyu
Yak Posting Veteran

80 Posts

Posted - 2002-06-18 : 05:03:03
thx a lot for you tips.
I'm still writing the asp pages. a busy day for me >_<



Go to Top of Page
   

- Advertisement -