Jump to content
Sign in to follow this  
drisate

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

Share this post


Link to post
Share on other sites

Um, what? You obviously have some form of server access, so what exactly prevents you from actually learning the database structure?

Share this post


Link to post
Share on other sites

It's actually complicated ... we own the website but not the DB and that makes it hard for us to develop any new features. They want us to hire them ... Just trying to show my boss we can manage with out them lol

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Sign in to follow this  

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