Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET MySQL
Hi all i am a beginner programmer and have a problem with a mySQL query. I have 2 tables 't1' and 't2'. There are 5 entries in t1 and for each entry in t1 there 5 entries in t2. How can i check if the entries in t2 are linked to entries in t1 using a mySQL query? Thanking you in advance.
Posted 27-Aug-12 1:43am
Ruwaldo733
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

It is no matter that both table having same record or how much record.
If there is some relation between table column is created then only you can say tables are linked
Like Primary key & foreign key
http://www.w3schools.com/sql/sql_foreignkey.asp
 
Or column from first table & second table are having some relation for eqality.
E.g first table Employee
column - empid empname depid
second table Dept
column - deptid deptname
Here two tables are linked with deptid
 
Suppose first table having only these two column
empid empname then there is no relation between two table.(I dont see such situation)
You should understand first what functionality you are providing then according to see database design. Then you get link between tables.
Please go through this link for relational design in database table.
http://parallel.vub.ac.be/documentation/database/tutor/
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 480
1 Bhavik_Patel 190
2 Richard MacCutchan 155
3 PhilLenoir 155
4 Gihan Liyanage 155
0 Sergey Alexandrovich Kryukov 8,688
1 OriginalGriff 7,237
2 CPallini 2,598
3 Richard MacCutchan 2,080
4 Abhinav S 1,888


Advertise | Privacy | Mobile
Web04 | 2.8.140827.1 | Last Updated 27 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100