Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
Old 12-05-2007, 11:17 PM MySQL JOIN's
The PHP Professor

Posts: 340
Name: Alex
Location: Behind You
Trades: 0
I want to use a MySQL JOIN function but it does not work when i try to do it. This is what i have:

Code:
'SELECT users.*, COUNT(messages.messageid) AS messages_count, COUNT(messages.messageid)-SUM(messages.is_read) AS unread_messages, COUNT(events.eventid) AS events_count, COUNT(events.eventid)-SUM(event.is_read) AS unread_events FROM uploader_users AS users LEFT JOIN uploader_messages AS messages USING(userid) LEFT JOIN uploader_events AS events USING(userid) WHERE users.userid=%d AND users.password=\'%s\' GROUP BY users.userid ;'

But it does not work correctly, can some one help me. Dont say Google because i have looked through many manuals and tutorials.

Thanks in advance.
__________________
Go Kirby! <(" . "<) (^" . "^) (>" . ")> Talkupation!
microcolt is offline
Reply With Quote
View Public Profile Visit microcolt's homepage!
 
 
Register now for full access!
Old 12-06-2007, 02:07 AM Re: MySQL JOIN's
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,023
Name: Forrest Croce
Location: Seattle, WA
Trades: 0
What happens? Do you get an error, an empty result set, or something else...?
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Old 12-06-2007, 10:26 PM Re: MySQL JOIN's
The PHP Professor

Posts: 340
Name: Alex
Location: Behind You
Trades: 0
i get an empty result, but no errors.
__________________
Go Kirby! <(" . "<) (^" . "^) (>" . ")> Talkupation!
microcolt is offline
Reply With Quote
View Public Profile Visit microcolt's homepage!
 
Old 12-06-2007, 10:34 PM Re: MySQL JOIN's
joder's Avatar
Flipotron

Posts: 6,442
Name: James
Location: In the ocean.
Trades: 0
Are you calling this from PHP? Do you have access to the mysql utility or phpmyadmin where you can run the query and see the results?
joder is offline
Reply With Quote
View Public Profile
 
Old 12-08-2007, 07:27 PM Re: MySQL JOIN's
The PHP Professor

Posts: 340
Name: Alex
Location: Behind You
Trades: 0
Yes but i want to use the USING(userid) from 1 location not both.
__________________
Go Kirby! <(" . "<) (^" . "^) (>" . ")> Talkupation!
microcolt is offline
Reply With Quote
View Public Profile Visit microcolt's homepage!
 
Reply     « Reply to MySQL JOIN's
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.21359 seconds with 12 queries