Reputation: 716
SELECT id, name::tsvector @@ 'substring1 & substring2'::tsquery
FROM table
I have this. The result of this query has 2 fields: id, ?column? The ?column? field value is true or false. how can I get only the true results?
Upvotes: 0
Views: 131
Reputation: 1
use alias to reference your column
SELECT id, name::tsvector @@ 'substring1 & substring2'::tsquery AS condition
FROM table
WHERE condition = true
Upvotes: 0
Reputation: 5973
SELECT * FROM (
SELECT id, name::tsvector @@ 'substring1 & substring2'::tsquery
FROM table
) AS search
WHERE column = 't'
You can also use WITH: http://www.postgresql.org/docs/9.1/static/queries-with.html
Upvotes: 1
Reputation: 446
Add a WHERE clausure to fill this values. Something like this.
SELECT id, name::tsvector @@ 'substring1 & substring2'::tsquery FROM table WHERE ?column? = 1 (or True)
Upvotes: 0
Reputation: 15069
use WHERE clause.... (if i understand your need correctly)
WHERE condition = true
Upvotes: 0