search

Last Reply on Feb 13, 2012 01:51 AM By nedash

Posted on Feb 11, 2012 04:30 AM

hi

i have 3 table in my database

Trade Table

 

T_code

Name

Keyword

1

Hotel

Hote

1

Hotel

Travel

1

Hotel

Room

2

Training

English

2

Training

Sport

 

 

hotel table

 

T_code

HotelName

HotelAddress

HotelTell

1

Milan

Germany

32436565

1

Paris

Franch

25435863

1

Italy

Veniz

3685686

training table

 

T_code

trainingName

Address

tell

2

English

Germany

53434646

2

Computer

Franch

25435863

2

Sport

Veniz

254

 

 

i want when user write keyword that exist in trade table it connect to table that is in keyword rows

EX: user write room  in TB and click search button it will connect to Hotel table and show hotel table columns

i dont know how i can make relation between trade-hotel-training Tables?

 

 

 

 

 

 

 

 

 

 

 

You are viewing reply posted by: Mudassar on Feb 12, 2012 10:33 PM.
Posted on Feb 12, 2012 10:33 PM

This is the query you need

 

declare @tcode int
select @tcode = t_code from Trade table

if tcode = 1
begin
select hotelname from hotel
end

if tcode = 2
begin
select trainingName from training
end