•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 361,569 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,063 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: 591 | Replies: 4
![]() |
•
•
Join Date: May 2008
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
Hello Friends,
I have three table and i want to select data from them
Table 1
Roll No. --- Name---Age
1------------a--------12
2------------b--------13
Table 2
Roll No.---Name---Age
7------------d------12
8------------b------13
9------------c------12
Table 10
Roll No.---Name---Age
41---------d---------12
43---------b---------13
44---------c---------12
Table 3
Roll No.---Sex
1------------f
7------------f
41----------f
i want to select date from Table 1 and Table 2 and Table 3 only for the Rolle No. 1 and 7. i tried inner loop. total table are 10. I want to display age and sex.
I have three table and i want to select data from them
Table 1
Roll No. --- Name---Age
1------------a--------12
2------------b--------13
Table 2
Roll No.---Name---Age
7------------d------12
8------------b------13
9------------c------12
Table 10
Roll No.---Name---Age
41---------d---------12
43---------b---------13
44---------c---------12
Table 3
Roll No.---Sex
1------------f
7------------f
41----------f
i want to select date from Table 1 and Table 2 and Table 3 only for the Rolle No. 1 and 7. i tried inner loop. total table are 10. I want to display age and sex.
•
•
Join Date: Apr 2008
Posts: 243
Reputation:
Rep Power: 1
Solved Threads: 28
hi deepman,
try this
So far, i didn't test it.
what is the reason, that you have split the data over various tables?
krs,
tesu
try this
sql Syntax (Toggle Plain Text)
SELECT t.rollno, t.age, s.sex FROM table1 t JOIN table3 s ON t.rollno = s.rollno WHERE s.rollno = 1 OR s.rollno = 7 union SELECT t.rollno, t.age, s.sex FROM table2 t JOIN table3 s ON t.rollno = s.rollno WHERE s.rollno = 1 OR s.rollno = 7 union SELECT t.rollno, t.age, s.sex FROM table10 t JOIN table3 s ON t.rollno = s.rollno WHERE s.rollno = 1 OR s.rollno = 7
what is the reason, that you have split the data over various tables?
krs,
tesu
•
•
Join Date: May 2008
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
tesuji
actualy have 10 tables for different classes.
Table A for Batch 1
___________________
Roll No. | Name | Age
A1 aa 12
A2 ab 13
A3 bb 12
Table B for Batch 2
___________________
Roll No. | Name | Age
B1 ac 12
B2 ad 13
B3 ba 12
Table c for Batch 3
___________________
Roll No. | Name | Age
C1 ae 12
C2 ad 13
C3 bd 12
Table S for Batch 2
___________________
Roll No. | Sex
A1 f
B3 f
C2 f
I want to select details from table A,B,C for the Roll No. in table S
actualy have 10 tables for different classes.
Table A for Batch 1
___________________
Roll No. | Name | Age
A1 aa 12
A2 ab 13
A3 bb 12
Table B for Batch 2
___________________
Roll No. | Name | Age
B1 ac 12
B2 ad 13
B3 ba 12
Table c for Batch 3
___________________
Roll No. | Name | Age
C1 ae 12
C2 ad 13
C3 bd 12
Table S for Batch 2
___________________
Roll No. | Sex
A1 f
B3 f
C2 f
I want to select details from table A,B,C for the Roll No. in table S
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb MySQL Marketplace
•
•
•
•
access advice broadband business code combo crime css cult of the dead cow daniweb data data protection data transfer database div drive dropdownlist encryption europe forensic forensics fun gadget google government hacking hard hardware help hitachi hp html industrial espionage it mobile module net news privacy protection reuse search security storage symantec tables terabyte tutorials and more web wikipedia
- Searching Multiple tables... Please help me!!!!! (PHP)
- data from multiple tables (VB.NET)
- Datas from different tables in one crystal report.. (Visual Basic 4 / 5 / 6)
- php script for dropdown to fetch DB list and then Tables (PHP)
- Searching for a record in multiple tables (VB.NET)
- Multiple Tables in a Database (Visual Basic 4 / 5 / 6)
Other Threads in the MySQL Forum
- Previous Thread: ORDER BY Multiple Columns
- Next Thread: truncate


Linear Mode