LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-10-2004, 04:14 PM   #1
Gerardoj
Member
 
Registered: May 2003
Location: Somewhere over the Rainbow
Distribution: Slackware 9.x, Knoppix, Damn Small Linux, RedHat.
Posts: 465

Rep: Reputation: 30
MySQL Query Help


I have 2 tables on my DB, called PredictionData and MatchData, the first one is where all the predictions of the user are stored, the second table is where the real scores are stored. I have the following formula and I would like some help to create the SELECT on base that formula:

Formula:
The user predict:
ITA = 3 ESP = 2
The real scores:
ITA = 4 ESP = 2

If the user predict that ITALY wins and ITALY win then count that one. Or if the user predict that SPAIN wins and SPAIN win then just count that one.

I was creating a select like the below but it weird... It will be great if someone can help here. Thanks

PHP Code:
SELECT Count(*) FROM PredictionData LEFT JOIN MatchData ON PredictionData.matchdate MatchData.matchdate WHERE PredictionData.homescore MatchData.homescore AND PredictionData.awayscoreMatchData.awayscore AND PredictionData.homescore PredictionData.awayscore and PredictionData.homescore <> PredictionData.awayscore and PredictionData.homescore <> MatchData.homescore and PredictionData.awayscore <> MatchData.awayscore and MatchData.homescore <> '0' and MatchData.awayscore <> '0' and PredictionData.User 'Michael'
 
Old 06-10-2004, 09:54 PM   #2
eric.r.turner
Member
 
Registered: Aug 2003
Location: Planet Earth
Distribution: Linux Mint
Posts: 216

Rep: Reputation: 31
Please post your table descriptions, and some data from the tables (perhaps 10 rows of data from each table.) It's difficult to write SQL without knowing that information!
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mySQL query help ezra143 Programming 3 04-25-2005 03:17 PM
Need mysql query help DropHit Linux - Software 7 04-01-2005 11:32 AM
Mysql Error: Lost Connection to Mysql during query ramnath Programming 5 11-18-2003 12:27 PM
mysql query ? shaahul Linux - Software 1 09-06-2003 03:35 AM
mysql query !!! hitesh_linux Linux - General 1 02-03-2003 03:36 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration