•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 397,786 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,364 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser:
Views: 1187 | Replies: 5
![]() |
Problem:
I have two tables and those two table have one field in common which is "S_ID"
first table have 2 fields:
"S_ID", "T_ID"
second table have these fields:
"S_ID", "First", "Last"
----------------------------------
What i want to do is that i need to extract the the field "S_ID" from the first table and order them by the field "Last" which is in the other table.
any one know how i can do that in one or 2 query.
Also I am using php.
I have two tables and those two table have one field in common which is "S_ID"
first table have 2 fields:
"S_ID", "T_ID"
second table have these fields:
"S_ID", "First", "Last"
----------------------------------
What i want to do is that i need to extract the the field "S_ID" from the first table and order them by the field "Last" which is in the other table.
any one know how i can do that in one or 2 query.
Also I am using php.
•
•
Join Date: Oct 2005
Location: Manchester, UK
Posts: 481
Reputation:
Rep Power: 3
Solved Threads: 31
•
•
•
•
Problem:
I have two tables and those two table have one field in common which is "S_ID"
first table have 2 fields:
"S_ID", "T_ID"
second table have these fields:
"S_ID", "First", "Last"
----------------------------------
What i want to do is that i need to extract the the field "S_ID" from the first table and order them by the field "Last" which is in the other table.
any one know how i can do that in one or 2 query.
Also I am using php.
select ft.s_id from first_table ft join second_table st on ft.s_id = st.s_id order by st.s_id
Last edited by pty : Sep 10th, 2006 at 3:15 pm. Reason: code tags
Note to self... pocket cup
•
•
Join Date: Oct 2005
Location: Manchester, UK
Posts: 481
Reputation:
Rep Power: 3
Solved Threads: 31
•
•
•
•
Thanks A lot.
That worked really nice.
I never really understood JOIN commands, even if i read the books for SQL they only comfused me more LOL.
A join basically combines records from more than one table. This article may help but the best way to understand is to make some test tables and actually have a go at constructing queries that utilise different types of joins.
Note to self... pocket cup
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb MySQL Marketplace
Similar Threads
- Removing Query Strings (ASP.NET)
- Double MySQL Query (PHP)
- Dynamic Query (JSP)
- MySQL nested query / joined query conversion help (MySQL)
- problem with lengthy query (Java)
- Retreiving variables from a sql query into a form (PHP)
- Sql Query (VB.NET)
- Query Building (Database Design)
Other Threads in the MySQL Forum
- Previous Thread: cannot connect mysql 5.0 live server though command prompt
- Next Thread: most popular scripting language


Linear Mode