Welcome Guest ( Log In | Register )




                Web Hosting Guide

MySQL, Multiple Tables
nightfox
post Jul 25 2006, 02:24 AM
Post #1


NiGHTFoX - Hiding in the dark
Group Icon

Group: Members
Posts: 680
Joined: 3-April 05
Member No.: 3,584


Ok, I'm coding a project which is a leap than what I'd normally do. Before, I've always learned ONE table... put EVERYTHING in one database table.

I'm making a profile system so there needs to be at least two tables: 1 for users, 1 for content. My problem is, how do I link the two together? I could probably figure this out faster if someone explained and posted sample SQL code that shows how the two are linked together.

Thanks!!

[N]F
Go to the top of the page
 
+Quote Post
3 Pages V  < 1 2 3  
New Topic
Replies (20 - 27)
nightfox
post Aug 6 2006, 06:39 PM
Post #21


NiGHTFoX - Hiding in the dark
Group Icon

Group: Members
Posts: 680
Joined: 3-April 05
Member No.: 3,584


haha... well I guess I'll be a good programmer soon tongue.gif but first I need to build my libraries of code!

[N]F
Go to the top of the page
 
+Quote Post
vhortex
post Aug 7 2006, 03:55 AM
Post #22


Guilty Until Proven Innocent
Group Icon

Group: Members
Posts: 372
Joined: 13-April 05
Member No.: 3,937


i hope you wont get as lazy as i am..

darn.. i think i misunderstood a line or two of that saying..

------

if something is hard to do..
then it is not worth doing it.. LOL
Go to the top of the page
 
+Quote Post
iGuest
post May 16 2008, 05:29 AM
Post #23


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 0
Joined: 1-November 07
Member No.: 25,869


its great site to help us
MySQL, Multiple Tables

All you have done a grate job for mysql users like us ... Thanks.
Go to the top of the page
 
+Quote Post
iGuest
post Jul 8 2008, 11:15 AM
Post #24


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 0
Joined: 1-November 07
Member No.: 25,869


Retrieving Data from Multiple Table
MySQL, Multiple Tables

Table1
Id
Full_name

Table2
Id
Contact_address

Table3
Id
Products

Query option as below
I want to search
? full_name <>
? contact_address <>
? products <>

But record in the format of

Id | full_name | contact_address | products


Please help me the good performance tunning codes. (database in mysql and script language is PHP)

Thanks!

-question by Krishna Aryal
Go to the top of the page
 
+Quote Post
darkken
post Jul 24 2008, 09:56 AM
Post #25


Newbie [ Level 2 ]
Group Icon

Group: [HOSTED]
Posts: 26
Joined: 2-July 08
Member No.: 31,263


i would recommend reading up on the t1 t2 commands for mysql. it is in the mysql manuel files.
CODE
$sql = "SELECT t1.name, t2.location FROM users t1, profiles t2"


Go to the top of the page
 
+Quote Post
iGuest
post May 16 2009, 06:39 PM
Post #26


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 0
Joined: 1-November 07
Member No.: 25,869


Multiple tables in MySQL
MySQL, Multiple Tables

Replying to nightfoxIn the database I worked on in the 1960s things were so much easier - We just created a field name in the global dictionary that could directly accessa field from another table.
-reply by Leon Wooldridge
Go to the top of the page
 
+Quote Post
iGuest
post Jun 30 2009, 07:21 AM
Post #27


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 0
Joined: 1-November 07
Member No.: 25,869


get data from two tables plz plz help meout
MySQL, Multiple Tables

I need to write a query which get array of data from one table and then search in second table at basis of result..Please help me..I can forward my code its only return me one record and search that one rec in second table ..I wanna get  more then one rec Please Please Please help me out..

$show_months5="select * from job_application where email='$email'";
Echo "select * from job_application where email='$email'";
                         $result5=mysql_query($show_months5);
                        $get_array5=mysql_fetch_array($result5);
                                        $month5=$get_array5['job_id'];
                                      $show_month_inf="select * from job where job_id='$month5'";
                          echo "select * from job where job_id='$month5'";
                                     $result1=mysql_query($show_month_inf);

-question by moon

Go to the top of the page
 
+Quote Post
iGuest
post Oct 14 2009, 07:15 AM
Post #28


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 0
Joined: 1-November 07
Member No.: 25,869


Joins between many to many relationships
MySQL, Multiple Tables

Hi Guys,

I'm struggling to understand the Join statements - I've seen many Examples of the Joins between one to many - many to one relationships - But none with many to many - where we have one main table - joint table - lookup table.

I would most probably do it this way:

SELECT * FROM shoes AS sh, colours AS col, shoes_colurs AS shc WHERE sh.Id = shc.Shoe AND col.Id = shc.Colour ORDER BY sh.Name ASC

Now - it would obviously work fine, but the question is - is there a better approach - using perhaps JOIN statement?

This is very simple statement - but I have one which is referring To a larger number of the joint tables as one entity can have more many To many relationships - and this kind of approach can generate quite Long statement - this is why I'm wondering if there's a better approach To this one.

Your help would be appreciated.

-reply by Mark
Go to the top of the page
 
+Quote Post

3 Pages V  < 1 2 3
Reply to this topicNew Topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No new   19 lonebyrd 3,622 1st November 2009 - 03:49 PM
Last post by: iGuest
No New Posts   9 jedipi 4,663 28th October 2009 - 08:09 PM
Last post by: HannahI
No New Posts   11 nightfox 2,053 23rd October 2009 - 07:52 AM
Last post by: surfermac
No New Posts 6 Spencer 363 21st October 2009 - 06:25 AM
Last post by: evought
No New Posts   0 evought 45 19th October 2009 - 07:13 AM
Last post by: evought
No New Posts   8 WeaponX 2,189 8th October 2009 - 07:54 PM
Last post by: HannahI
No New Posts   3 starscream 100 8th October 2009 - 07:51 PM
Last post by: HannahI
No new   31 Jackel 6,303 6th October 2009 - 06:33 AM
Last post by: iG-cronuz08
No New Posts   3 darkken 2,394 11th September 2009 - 08:26 PM
Last post by: iGuest
No New Posts   6 ruben 1,552 27th August 2009 - 09:07 AM
Last post by: iG-J vincent
No New Posts   4 miCRoSCoPiC^eaRthLinG 6,458 21st August 2009 - 01:59 PM
Last post by: iG-J vincent
No New Posts 1 sofiaweb 132 7th August 2009 - 08:15 PM
Last post by: yordan
No New Posts   9 bakr_2k5 1,849 29th July 2009 - 11:02 PM
Last post by: iG-Wicky
No New Posts   2 FirefoxRocks 248 24th July 2009 - 08:02 PM
Last post by: FirefoxRocks
No New Posts   4 FirefoxRocks 257 23rd July 2009 - 04:23 AM
Last post by: FirefoxRocks


Web Hosting Powered by ComputingHost.com.