Jump to content

[SOLVED] on localhost sql works on server not?


DEVILofDARKNESS

Recommended Posts

I have the following query which perfectly works on my localhost, but doesn't run on my webserver (hosted at combell.com) although it is exact the same database

 

SELECT nations.nation_name, nations.nation_id, (SELECT SUM( weapons.power) * region_weapons.ammount) As power FROM weapons INNER JOIN region_weapons ON region_weapons.weapon_id = weapons.weapon_id INNER JOIN regions ON regions.region_id = region_weapons.region_id INNER JOIN nations ON nations.nation_id = regions.nation_id GROUP BY nations.nation_name ORDER BY power DESC

 

Why is this possible and what can I do?

Link to comment
Share on other sites

Hi

 

My brain hurts and I am certain I have done this inefficiently but at this moment can't think of a better way.

 

However, this would seem logically better:-

 

SELECT nations.nation_name, nations.nation_id, SUM(tmpPower) AS power 
FROM nations 
INNER JOIN regions ON nations.nation_id = regions.nation_id 
INNER JOIN (SELECT region_weapons.region_id , weapons.power * region_weapons.ammount AS tmpPower
FROM weapons 
INNER JOIN region_weapons 
ON region_weapons.weapon_id = weapons.weapon_id ) Deriv1 ON regions.region_id = Deriv1.region_id
GROUP BY nations.nation_name 
ORDER BY power DESC[code]

All the best

Keith

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.