FireFox! The PHP Forum Loans and Credit
Panama Web Design for Hire Free Insurance Quotes!
Web Hosting Advertise Here $10 a Month Designer Children
Never Pay Taxes Again HGH Domain name registration
Web Hosting and Dedicated Servers Insurance Affordable web-hosting


HomeWatched TopicsRegisterSearchDirectory
FAQMemberlistUsergroupsLog inStoresItemsBank
Google

Reply to topic Page 1 of 1
Complex mysql (joins?)
Message  

Reply with quote
Post Complex mysql (joins?) 
I have a set of database tables.

three contain user info, event info and fee info

one table contains the id's linking user to event

one table links fee's to events

one table links users to fees


I'm thinking this might be a little too complicated and maybe I should just have fees in with events although not all fees are associated with an event.

what I want to do is with the User ID I want to get the events associated with that user through the event/user table then compare them to the event/fee table and get the fee ids associated with (if any) of the events.

then I want to take that fee id and user id and insert them into the fee/user table.

I'm not very good with joins and I think that is what I need to use. and sugestions?

Sarah


_________________
Sarah Atkinson
View user's profile Send private message Send e-mail

Reply with quote
Post Re: Complex mysql (joins?) 
SarahAtkinson wrote:
I have a set of database tables.

three contain user info, event info and fee info

one table contains the id's linking user to event

one table links fee's to events

one table links users to fees


I'm thinking this might be a little too complicated and maybe I should just have fees in with events although not all fees are associated with an event.

what I want to do is with the User ID I want to get the events associated with that user through the event/user table then compare them to the event/fee table and get the fee ids associated with (if any) of the events.

then I want to take that fee id and user id and insert them into the fee/user table.

I'm not very good with joins and I think that is what I need to use. and sugestions?

Sarah

It'd be easier... if you pasted your database structure all though heres an attempt:

Code:

SELECT * FROM users AS a LEFT JOIN events AS b ON (a.id = b.user_id) LEFT JOIN fees AS c ON (b.id = c.event_id) WHERE a.id = 'USER_ID'

Hopefully this will be of some help?  If you don't figure it out paste your database structure and I'll see if I can't help you more.


_________________
Software Engineer
http://www.tuxmafia.com
View user's profile Send private message Visit poster's website
Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
  



Google

FireFox! The PHP Forum Loans and Credit
Panama Web Design for Hire Free Insurance Quotes!
Web Hosting Advertise Here $10 a Month Designer Children
Never Pay Taxes Again HGH Domain name registration
Web Hosting and Dedicated Servers Insurance Affordable web-hosting


Web Design by PlatinumShore.com & Web Hosting by TradeWebHosting.com