View Single Post
  #6  
Old 03-29-2005, 04:58 AM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, no response from her,

Here is my current query (whole thing)
[sql]
SELECT DISTINCT team.id, team.manager, team.managerid,
team.batsmanid1, stats1.score AS batsman1score, stats1.scorebonus AS batsman1scorebonus,
team.batsmanid2, stats2.score AS batsman2score, stats2.scorebonus AS batsman2scorebonus,
team.batsmanid3, stats3.score AS batsman3score, stats3.scorebonus AS batsman3scorebonus,
team.batsmanid4, stats4.score AS batsman4score, stats4.scorebonus AS batsman4scorebonus,
team.batsmanid5, stats5.score AS batsman5score, stats5.scorebonus AS batsman5scorebonus,
team.wicketkeeper1, stats6.score AS wicketkeeper1score, stats6.scorebonus AS wicketkeeper1scorebonus,
team.allrounder1, stats7.score AS allrounder1score, stats7.scorebonus AS allrounder1scorebonus,
team.bowler1, stats8.score AS bowler1score, stats8.scorebonus AS bowler1scorebonus,
team.bowler2, stats9.score AS bowler2score, stats9.scorebonus AS bowler2scorebonus,
team.bowler3, stats10.score AS bowler3score, stats10.scorebonus AS bowler3scorebonus,
team.bowler4, stats11.score AS bowler5score, stats11.scorebonus AS bowler4scorebonus,
team.bonus1, team.bonus2, team.bonus3, team.bonus4, team.captain


FROM fc_team team, fc_player_stats stats1, fc_player_stats stats2, fc_player_stats stats3,
fc_player_stats stats4, fc_player_stats stats5, fc_player_stats stats6, fc_player_stats stats7,
fc_player_stats stats8, fc_player_stats stats9, fc_player_stats stats10, fc_player_stats stats11

WHERE team.gameid=$gameid
AND team.batsmanid1=stats1.playerid
AND stats1.gameid=$gameid
AND team.batsmanid2=stats2.playerid
AND stats2.gameid=$gameid
AND team.batsmanid3=stats3.playerid
AND stats3.gameid=$gameid
AND team.batsmanid4=stats4.playerid
AND stats4.gameid=$gameid
AND team.batsmanid5=stats5.playerid
AND stats5.gameid=$gameid
AND team.wicketkeeper1=stats6.playerid
AND stats6.gameid=$gameid
AND team.allrounder1=stats7.playerid
AND stats7.gameid=$gameid
AND team.bowler1=stats8.playerid
AND stats8.gameid=$gameid
AND team.bowler2=stats9.playerid
AND stats9.gameid=$gameid
AND team.bowler3=stats10.playerid
AND team.bowler4=stats11.playerid
AND stats11.gameid=$gameid

ORDER BY team.manager ASC, stats1.matchid ASC[/sql]

This is probably very uneffecient, could this be done using a LEFT/RIGHT/INNER JOIN?

-- If I started the whole project from scratch (or had tons of time on my hands) I would change the table structure, but it's too late for that.
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01736 seconds
  • Memory Usage 1,763KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete