Hivemind SQL query tip: Getting posts by multiple tag selection

in #hivemind5 years ago (edited)

Get the posts tagged as utopian-io and development and python


SELECT author, 
       permlink 
FROM   hive_posts 
WHERE  id IN (SELECT post_id 
              FROM   hive_post_tags 
              WHERE  tag = 'python' 
              intersect 
              SELECT post_id 
              FROM   hive_post_tags 
              WHERE  tag = 'development' 
              intersect 
              SELECT post_id 
              FROM   hive_post_tags 
              WHERE  tag = 'utopian-io') 
ORDER  BY created_at DESC 
LIMIT  10; 

Result:


   author   |                                               permlink
------------+-------------------------------------------------------------------------------------------------------
 sisygoboom | redfisher-bot--discover-and-support-small-accounts
 espoem     | fpl-updating-tests-and-minor-fixes
 emrebeyler | new-version-on-tower-hivemind-rest
 holger80   | update-for-beem-getblog-getfollowers-and-getfollowing-works-for-api-steemit-com
 imwatsi    | trader-bfx-backend-order-books-settings-module-and-tickers
 sisygoboom | redfisher-v10--support-small-accounts-that-act-in-a-positive-way
 imwatsi    | trading-assistant-bot-bitfinex-api-websocket-connection-channel-subscriptions-and-candle-data-parsing
 emrebeyler | instasteem-a-cli-app-library-to-cross-post-instagram-content-into-your-steem-profile
 pinkwonder | fceux-remote-controlling
 sisygoboom | steem-late-vote-explorer--210

Planning to expose this with the tower API since this is the million dollar question asked several times in SteemDevs discord, before. :)

Sort:  

Forget sliced bread! This is the stuff

Posted using Partiko Android

Is this already working or only a proposal?

It's working. What do you mean by proposal?

Is there hivemind API? How to use this query?

Ah, no. Hivemind doesn't expose this query. You can access it if you have a synced Hivemind database.

However, I have added this to the Tower API. Will announce it soon.

Commenting to save

This post has been included in the latest edition of SoS Daily News - a digest of all you need to know about the State of Steem.

Coin Marketplace

STEEM 0.30
TRX 0.12
JST 0.034
BTC 64455.55
ETH 3147.84
USDT 1.00
SBD 3.94