Cregg - 07/12/2014

Local Trainers Winner Of Two

print
SELECT e.entry_id, r.race_no, r.fixture_id, e.entry_order, concat(e.rider_first_name, ' ', e.rider_last_name) as rider, e.rider_id, DATE_FORMAT( e.fixture_date, '%Y-%m-%d' ) AS fixturedate, DATE_FORMAT( DATE_ADD( e.fixture_date, INTERVAL -1 DAY), '%Y-%m-%d' ) AS formdate, e.horse_name, CONCAT(coalesce(e.orig_weight_stone, e.weight_stone), 'st ', coalesce(e.orig_weight_lbs, e.weight_lbs, '0'), 'lbs') as weight, CASE # WHEN e.colours IS NOT NULL AND e.colours <> '' THEN # CONCAT( '') WHEN e.jersey IS NOT NULL AND e.jersey <> '' THEN CONVERT(CONCAT( 'jersey') USING utf8mb4) # ELSE '' ELSE CONVERT(CONCAT( '') USING utf8mb4) END AS jersey, CONCAT( '(', CONCAT( YEAR(NOW()) - h.year_of_birth, 'yo'), ' ', h.colour, ' ', h.sex, ')' ) AS horsedata, CASE WHEN (SELECT x.horse_id FROM horses x WHERE x.horse_name = h.sire and x.year_of_birth = h.sire_year_of_birth and x.stallion = 'Y') IS NOT NULL THEN CONVERT(CONCAT( '', striphorsecountry( h.sire ), '' ) USING utf8mb4) # WHEN (SELECT x.horse_id FROM horses x WHERE x.horse_name = h.sire and x.year_of_birth = h.sire_year_of_birth) IS NOT NULL THEN # CONVERT(CONCAT( '', striphorsecountry( h.sire ), '' ) USING utf8mb4) ELSE CONVERT(striphorsecountry( h.sire ) USING utf8mb4) END AS sire, CASE WHEN (SELECT x.horse_id FROM horses x WHERE x.horse_name = h.dam and x.year_of_birth = h.dam_year_of_birth) IS NOT NULL THEN CONVERT(CONCAT( '', striphorsecountry( h.dam ), '' ) USING utf8mb4) ELSE CONVERT(striphorsecountry( h.dam ) USING utf8mb4) END AS dam, CASE WHEN (SELECT x.horse_id FROM horses x WHERE x.horse_name = h.maternal_sire and x.year_of_birth = h.maternal_sire_year_of_birth) IS NOT NULL THEN CONVERT(CONCAT( '(', striphorsecountry( h.maternal_sire ), ')' ) USING utf8mb4) ELSE CONVERT(CONCAT('(',striphorsecountry( h.maternal_sire ),')') USING utf8mb4) END AS maternal_sire, COALESCE( CONCAT( 'Colours: ', e.colours), '') AS colours, COALESCE( e.owner, '') AS owner, COALESCE( e.trainer, '') AS trainer, COALESCE( CONCAT( h.hunt, ' ', h.hunt_year), '') AS hunt, h.hunt AS huntname, '' AS ratings1, '' AS ratings2, '' AS ratings3, e.year_of_birth, h.family_note, h.sire, h.dam, case when e.bidable = 'Y' then '###bidable_popup###' else '' end bidable, COALESCE(DATEDIFF( e.fixture_date, (select max(ed.fixture_date) from entries ed where ed.horse_name = h.horse_name and ed.year_of_birth = h.year_of_birth and (ed.finish_position is not null or ed.finish_status is not null) and ed.fixture_date < e.fixture_date)), '-') as dayssince FROM entries e LEFT JOIN horses h ON e.horse_name = h.horse_name and e.year_of_birth = h.year_of_birth LEFT JOIN races r ON e.race_id = r.race_id WHERE e.race_id = '21046' order by entry_order #ORDER BY # entry_order
Fatal error: Uncaught mysqli_sql_exception: Illegal mix of collations for operation 'concat' in /usr/share/pear/DB/mysqli.php:403 Stack trace: #0 /usr/share/pear/DB/mysqli.php(403): mysqli_query() #1 /usr/share/pear/DB/common.php(1219): DB_mysqli->simpleQuery() #2 /mnt/sdg/p2p_source/modules/database/database.php(656): DB_common->query() #3 /mnt/sdg/p2p_source/www/processors/entries.php(277): dbms->getRecordSet() #4 /mnt/sdg/p2p_source/www/processors/entries.php(680): getEntryHorses() #5 /mnt/sdg/p2p_source/www/processors/entries.php(1814): getRaceCard() #6 /mnt/sdg/p2p_source/www/entries.php(81): getEntriesTab() #7 {main} thrown in /usr/share/pear/DB/mysqli.php on line 403