Jump to content

Select a col without knowing the table it's contained in


Recommended Posts

Hey guys I am testing a query that returns:
function is called Allowed memory size of 134217728 bytes exhausted (tried to allocate 2097160 bytes)

now i know i can change the memory limit ... but I would prefer optimizing the query instead.

select * from devices where hardware_id=(select hardware_id from (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME ='hardware_id' order by TABLE_NAME asc limit 1) as T where hardware_id!='' order by id asc limit 1)

Is there a better way of searching for hardware_id in the first found table that contains them?

I tryed adding the limit 1 param in both sub query's ... but that did not change the allowed memory error.
I wish i had the database table structure but I am flying blind ...

Thx in adavnce

Edited by drisate

With attempts like this, you're just making a fool of yourself. And the queries are so hopelessly wrong that you'll sooner or later have to write them all over again.

 

So you have shell access to your server containing the PHP application, right? And the application obviously contains the database credentials. Extract them, connect to the database and start digging. If the database is publicly reachable, you can even use your favorite admin GUI on your PC.

Edited by Jacques1
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.