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 Extracting Data into Three Table

Author  Topic 

Easwar
Yak Posting Veteran

59 Posts

Posted - 2007-03-22 : 07:28:27

This is my sample table Data

table1
TagID|TagName
--------------
1|xyz
2|123abc
3|a3bc
4|arsdew
5|xyc324
..............
..............

TagID--Primary Key

table2

TopicID|Topic
----------------
1|jkkj
2|kjgg
3|jhkj
4|refc
5|huhf
8|fyhj
9|jjk
...............
.............
..........
TopicID---Primary Key

table3
DetID|TagID|TopicID
-----------------------
1|1|1
2|1|2
3|1|3
4|2|4
5|2|5
8|3|8
9|3|9
....................
...................
.................

DetID---Primary key
TagID and TopicID----Foreign key


i need Topic based on TagName.


This xyz(TagName) have a 3 Topic. i need the 3 Topic

Once i select 123abc(TagName) that particular Topic I need..

any Query in Single Line.......................

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-03-22 : 07:37:13
there you go . . . Query in Single Line

select t2.topic from table1 t1 join table3 t3 on t1.tagid = t3.tagid join table2 t2 on t3.topicid = t2.topicid where t1.tagname=@tagname



KH

Go to Top of Page

Easwar
Yak Posting Veteran

59 Posts

Posted - 2007-03-22 : 07:54:54
Thanks very much.............
Go to Top of Page
   

- Advertisement -