Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8916461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:14:57+00:00 2026-06-15T05:14:57+00:00

Currently, to get the data I need, I need to execute multiple SQL statements:

  • 0

Currently, to get the data I need, I need to execute multiple SQL statements:

SELECT pubkey.pubkey_id 
FROM pubkey 
WHERE pubkey.pubkey_hash = (input data [1])

SELECT txin_corr.tx_id 
FROM txin_corr 
WHERE txin_corr.pubkey_id = (pubkey.pubkey_id from previous query [max. 1])

SELECT txin_corr.pubkey_id 
FROM txin_corr 
WHERE txin_corr.tx_id = (txin_corr.tx_id from prev.qry. [n])

SELECT pubkey.pubkey_hash
FROM pubkey 
WHERE pubkey.pubkey_id = (txin_corr.pubkey_id from prev.qry. [n])

The first query is no problem because I only have to do it once. But I’m wondering if there is a way to combine (at least) the last three queries. As the db is pretty big (~ 20 GB), I think a “good query” may speed things up considerably.

What I’m doing is: For a given pubkey_id/pubkey_hash, get all tx_ids from txin_corr that contain this pubkey_id in the same row. Then, get all pubkey_ids from txin_corr where the row contains the retrieved tx_ids. Finally, get all the pubkey_hashs for the now retrieved pubkey_ids.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T05:14:58+00:00Added an answer on June 15, 2026 at 5:14 am

    The earlier answer is correct: the key is to join the tables together multiple times. But, there are one-to many relationships in there, so there will need to be left outer joins, not just the inner joins.

    SELECT pk2.pubkey_hash
    FROM   pubkey pk
    INNER JOIN txin_corr tc ON pk.pubkey_id = tc.pubkey_id
    LEFT OUTER JOIN txin_corr tc2 ON tc.tx_id = tc2.tx_id
    LEFT OUTER JOIN pubkey pk2 ON tc2.pubkey_id = pk2.pubkey_id
    WHERE pk.pubkey_hash = (input data)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently using this code to get data from a URL: NSURL *url
I'm trying to get a certain data from mysql with fetchAll. I currently have
I need to get summary data from many many rows. The summary fields are
I am currently trying to get data out of a plist. It basically looks
Currently I'm using file_get_contents() to submit GET data to an array of sites, but
My current application needs to get data from a file to initialize its attributes.
I'm currently trying to get the most popular productID from my MSSQL Database. This
I am currently trying to get multiple xml files into my xsl file to
Currently have this to get a value from the registry in TSQL. However, I
We have several SQL scripts which are generated from an Entity Model. They need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.