Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Database Server Software > MySQL > how write selection

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-08-03, 01:48
Sliekas_satana Sliekas_satana is offline
Registered User
 
Join Date: Dec 2003
Posts: 2
Red face how write selection

hi
i have two table:
Table1
S1 S2 S3
1 2 1
2 1 3
3 3 2

Table2
id Text
1 One
2 Two
3 Three

How must i i write query to get such result:

One Two One
Two One Three
Three Three Two

Thank you
p.s. sorry for my english
Reply With Quote
  #2 (permalink)  
Old 12-08-03, 05:47
Mincer Mincer is offline
Registered User
 
Join Date: Sep 2003
Location: London
Posts: 56
This look mightily like a homework assignment to me.

Here's an article on using SQL joins that will help you out.

http://www.devshed.com/Server_Side/M...oin/page1.html

Matt.
Reply With Quote
  #3 (permalink)  
Old 12-08-03, 07:21
Sliekas_satana Sliekas_satana is offline
Registered User
 
Join Date: Dec 2003
Posts: 2
ghm...
With joins?! I don't know how
ok maybe in MySQL there are posible to merge two Query
for example
SELECT text as t1 FROM Table1, Table2 where id = s1
and
SELECT text as t2 FROM Table1, Table2 where id = s2

and get one result with two colums T1 and T2
?????

Thanks
Reply With Quote
  #4 (permalink)  
Old 12-08-03, 07:47
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 13,556
Code:
select T2_1.text as T1text , T2_2.text as T2text , T2_3.text as T3text from Table1 inner join Table2 as T2_1 on Table1.S1 = T2_1.id inner join Table2 as T2_2 on Table1.S2 = T2_21.id inner join Table2 as T2_3 on Table1.S3 = T2_3.id
rudy
http://r937.com/
Reply With Quote
  #5 (permalink)  
Old 12-10-03, 13:31
Shashant Shashant is offline
Registered User
 
Join Date: Nov 2003
Location: Philadelphia
Posts: 9
Re: how write selection

Quote:
Originally posted by Sliekas_satana
hi
i have two table:
Table1
S1 S2 S3
1 2 1
2 1 3
3 3 2

Table2
id Text
1 One
2 Two
3 Three

How must i i write query to get such result:

One Two One
Two One Three
Three Three Two

Thank you
p.s. sorry for my english


SELECT Table2.text, Table2_1.text, Table2_2.text
FROM Table2 AS Table2_2 INNER JOIN (Table2 AS Table2_1 INNER JOIN (Table2 INNER JOIN Table1 ON Table2.id = Table1.S1) ON Table2_1.id = Table1.S2) ON Table2_2.id = Table1.S3;
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On