This is a question for all those that are familiar with crafting Google BigData queries to extract data.
My request is fairly simple. I'm looking to extract a definitive list of smart contracts with unique bytecode.
The first query I sent through only gave me the # of contracts with unique bytecode (believe the # is about 25k or so).
Then I changed my query to the following:
SELECT
DISTINCT `bigquery-public-data.ethereum_blockchain.contracts`.bytecode AS unique_bytecode,
FROM
`bigquery-public-data.ethereum_blockchain.contracts`
All this does is return the bytecode for all results that match the query...which is close to what I'm looking for but still no cigar. Instead, I'm looking for the accompanying smart contract addresses for the results that match the query (hope this makes sense how I've worded it).
In laymen's terms, I'm trying to craft a Google BigData query that returns the addresses of all smart contracts with unique bytecode (i.e., no smart contract address that's returned should have a bytecode that matches any other returned result from the query).
SELECT MIN(address), bytecode FROM contracts GROUP BY bytecode– user253751 Dec 12 '22 at 11:36DISTINCTbefore the bytecode modifier to stipulate that the results should be unique? If you happen to know a SQL query that will achieve this same goal, that works too bc Google BigData has a feature that allows you to convert SQL queries to BigData format. – librehash Dec 12 '22 at 17:11ASphrases for the sake of labeling the columns on output, but that was just for aesthetic / visual purposes. You nailed it man. Thanks! Wish I could give you best answer but it won't let me do it for comments. – librehash Dec 14 '22 at 09:12