Jump to content


  • Posts

  • Joined

  • Last visited


Profile Information

  • Gender
    Not Telling

VoodooJai's Achievements


Newbie (1/5)



  1. Many thanks for your patience I know it must be annoying for you all. I have been researching further with the info you supplied and I think I now have it working the way I wanted. I really only as for help when Im stuck and need a little nudge in the right direction. Thanks again I really appreciate the help. VoodooJai
  2. Hi again I am stil struggling with the query, if I display "race_results.position_fav_2" it just gives me the row ID of table2 and not the value assigned to that ID. I need to show 6 of these values from table2. These bits of the code "alias6.fav" etc are the ones causing me problems. Hope you can help thanks VoodooJai
  3. All values applicable in the results table have values in the favourites table. So how would I actually do this query then, I just cannt see the wood for the trees. Do I define an "AS" for each of the position_fav_# columns in the results table and display it for each of the horses. Something like: results.position_fav_1 = favourite.fav_id AS DisplayFav. Thanks again VoodooJai
  4. I have tried the solution but dont understand why it does not work and gives this result from this code mysql> SELECT results_id, alias1.fav, alias2.fav, alias3.fav, alias4.fav, alias5.fav, alias6.fav -> FROM race_results -> LEFT JOIN favourites AS alias1 ON race_results. position_fav_1 = alias1.fav -> LEFT JOIN favourites AS alias2 ON race_results. position_fav_2 = alias2.fav -> LEFT JOIN favourites AS alias3 ON race_results. position_fav_3 = alias3.fav -> LEFT JOIN favourites AS alias4 ON race_results. position_fav_4 = alias4.fav -> LEFT JOIN favourites AS alias5 ON race_results. position_fav_5 = alias5.fav -> LEFT JOIN favourites AS alias6 ON race_results. position_fav_6 = alias6.fav; +-------------+----------+ ----------+--------+--------+--------+---------+ | results_id | fav | fav | fav | fav | fav | fav | +-------------+----------+ ----------+--------+--------+--------+---------+ | 1 | 2nd-fav | 3rd-fav | NULL | NULL | NULL | NULL | | 2 | 2nd-fav | NULL | NULL | NULL | NULL | NULL | | 3 | 2nd-fav | NULL | NULL | NULL | NULL | NULL | | 4 | 2nd-fav | 3rd-fav | NULL | NULL | NULL | NULL | +-------------+----------+ ----------+--------+--------+--------+---------+ The NULL cells are supposed to show the type of favourite the horse is. Can anyone enlighten or show me whats wrong with the query. VoodooJai
  5. Thanks i will try this I was nearly on the right track, thanks. VoodooJai
  6. Hi all I am creating a db that holds info about horse racing table 1 contains the details abaout the horses and their finish positions and if they were a favourite in the race. Table 2 describes the favourite ie "Not a fav" "fav" "Join fav" "2nd fav" "Joint 2nd Fav". How could I display two different types of fav detail in the same row of a table. tbl 1 ID int Horse 1 varchar horse1_odds varchar horse1_fav int (Foreign key to fav table) Horse 2 varchar horse2_odds varchar horse2_fav int (Foreign key to fav table) Horse 3 varchar horse3_odds varchar horse3_fav int (Foreign key to fav table) table 2 ID int Fav varchar (fav description) Is it possible to reference table2 three times with different values in row 1 of table 1. A little help would be appreciated. VoodooJai
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.