| | |
Query seems to be crashing phpmyadmin/mysql
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Aug 2004
Posts: 24
Reputation:
Solved Threads: 0
Hi, I have the following query i'm trying to execute:
I only recently added the last 3/4 join statements but before those it was working, i'm not sure if there's a problem with my joins/join syntax any help would be greatly appreciated.
mysql Syntax (Toggle Plain Text)
SELECT CONCAT_WS(' ', g.genus_name, s.species_name, i.rank, i.infraspecies_name, conf.auth1, conf.auth2 ) AS scientific_name, cn.common_name, GROUP_CONCAT(cn.common_name ORDER BY cn.common_name SEPARATOR ', ' ) AS common_names, ui.unvouch_image_src, ui.unvouch_image_alt, gh.growth_habit, gd.gen_distrib_name FROM plants AS p LEFT JOIN (genera AS g, species AS s) ON (p.genus_num = g.genus_id AND p.species_num = s.species_id) LEFT JOIN (confirmations AS conf) ON (p.plant_id = conf.plant_num) LEFT JOIN (plant_growth_habits AS pgh, growth_habits AS gh) ON (p.plant_id = pgh.plant_num) LEFT JOIN (plant_distributions AS pd, gen_distribs AS gd) ON (p.plant_id = pd.plant_num) LEFT JOIN (plant_common_names AS pcn, common_names AS cn) ON (p.plant_id = pcn.plant_num) LEFT JOIN (unvouchered_images AS ui) ON (p.plant_id = ui.plant_num) LEFT JOIN (infraspecies AS i) ON (p.infraspecies_num = i.infraspecies_id) WHERE scientific_name LIKE '%sesuvium%' GROUP BY scientific_name ORDER BY scientific_name
•
•
Join Date: Aug 2004
Posts: 24
Reputation:
Solved Threads: 0
Ok it looks like i got the crashing problem fixed by reworking my query to:
the above query seems to be working fine but i got onnneee not so big issue i was wondering about. This line here:
works and everything but there will not always be a value for conf.auth1 or conf.auth2 and the concatenation sometimes prints say for e.g. "Sesuvium microphyllum Willd. NULL" where there was no value for conf.auth2. Is this the default behaviour of concat_ws, can i get around this or would i just have to strip that out using php?
mysql Syntax (Toggle Plain Text)
SELECT CONCAT_WS(' ',g.genus_name,s.species_name,i.rank,i.infraspecies_name, conf.auth1,conf.auth2) AS scientific_name, cn.common_name, GROUP_CONCAT(DISTINCT cn.common_name ORDER BY cn.common_name SEPARATOR ', ' ) AS common_names, ui.unvouch_image_src, ui.unvouch_image_alt, gh.growth_habit, GROUP_CONCAT(DISTINCT gh.growth_habit ORDER BY gh.growth_habit SEPARATOR ', ') AS growth_habits, gd.gen_distrib_name, GROUP_CONCAT(DISTINCT gd.gen_distrib_name ORDER BY gd.gen_distrib_name SEPARATOR ', ') AS general_dists FROM plants AS p LEFT JOIN genera AS g ON g.genus_id = p.genus_num LEFT JOIN species AS s ON s.species_id = p.species_num LEFT JOIN confirmations AS conf ON conf.plant_num = p.plant_id LEFT JOIN (plant_growth_habits AS pgh INNER JOIN growth_habits AS gh ON gh.growth_habit_id = pgh.growth_habit_num) ON pgh.plant_num = p.plant_id LEFT JOIN (plant_distributions AS pd INNER JOIN gen_distribs AS gd ON gd.gen_distrib_id = pd.gen_distrib_num) ON pd.plant_num = p.plant_id LEFT JOIN (plant_common_names AS pcn INNER JOIN common_names AS cn ON cn.common_name_id = pcn.common_name_num) ON pcn.plant_num = p.plant_id LEFT JOIN unvouchered_images AS ui ON p.plant_id = ui.plant_num LEFT JOIN infraspecies AS i ON p.infraspecies_num = i.infraspecies_id WHERE scientific_name LIKE '%sesuvium%' GROUP BY scientific_name ORDER BY scientific_name
mysql Syntax (Toggle Plain Text)
CONCAT_WS(' ',g.genus_name,s.species_name,i.rank,i.infraspecies_name,conf.auth1,conf.auth2) AS scientific_name
![]() |
Similar Threads
- Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource (PHP)
- mysql_fetch_array(): supplied argument is not a valid MySQL (PHP)
- What's wrong with my query? (MySQL)
- mysql UPDATE not working! Why? (PHP)
- Error message (MySQL)
- uploading .txt file via phpmyadmin to Mysql (MySQL)
Other Threads in the MySQL Forum
- Previous Thread: MySQL License
- Next Thread: what lecense
Views: 1147 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for MySQL
agplv3 alfresco api artisticlicense aws bizspark breathalyzer camparingtocolumns cmg communityjournalism contractors copyright count court data database design developer development distinct drupal dui ec2 eliminate email enter enterprise error eudora facebook form foss government gpl greenit groklaw hiring hyperic innerjoins insert ip joebrockmeier join journalism keyword keywords kickfire law legal license licensing maintenance managing mariadb matchingcolumns metron micromanage microsoft mindtouch montywidenius mozilla multiple music mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery news open-xchange opendatabasealliance opengovernment opensource oracle pdf penelope php query referencedesign remove reorderingcolumns results resultset saas search select sharepoint simpledb sourcecode spotify sql statement sugarcrm syntax techsupport thunderbird transparency update virtualization





