{"action":"created","issue":{"url":"https://api.github.com/repos/tgriesser/knex/issues/949","repository_url":"https://api.github.com/repos/tgriesser/knex","labels_url":"https://api.github.com/repos/tgriesser/knex/issues/949/labels{/name}","comments_url":"https://api.github.com/repos/tgriesser/knex/issues/949/comments","events_url":"https://api.github.com/repos/tgriesser/knex/issues/949/events","html_url":"https://github.com/tgriesser/knex/issues/949","id":103208660,"node_id":"MDU6SXNzdWUxMDMyMDg2NjA=","number":949,"title":"How to construct `SELECT (EXISTS ...))`?","user":{"login":"sorawit","id":5730246,"node_id":"MDQ6VXNlcjU3MzAyNDY=","avatar_url":"https://avatars2.githubusercontent.com/u/5730246?v=4","gravatar_id":"","url":"https://api.github.com/users/sorawit","html_url":"https://github.com/sorawit","followers_url":"https://api.github.com/users/sorawit/followers","following_url":"https://api.github.com/users/sorawit/following{/other_user}","gists_url":"https://api.github.com/users/sorawit/gists{/gist_id}","starred_url":"https://api.github.com/users/sorawit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sorawit/subscriptions","organizations_url":"https://api.github.com/users/sorawit/orgs","repos_url":"https://api.github.com/users/sorawit/repos","events_url":"https://api.github.com/users/sorawit/events{/privacy}","received_events_url":"https://api.github.com/users/sorawit/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2015-08-26T08:34:35Z","updated_at":"2018-05-31T19:05:52Z","closed_at":"2015-08-26T16:31:48Z","author_association":"NONE","body":"Hi. Is it possible to construct query like this with knex?\n\n`SELECT id\n  ,name\n  ,EXISTS (SELECT 1\n   FROM options\n   WHERE customer_id = customers.id\n   AND option_name = 'Editor') AS isEditor\nFROM customers`\n\nThanks!\n"},"comment":{"url":"https://api.github.com/repos/tgriesser/knex/issues/comments/393643316","html_url":"https://github.com/tgriesser/knex/issues/949#issuecomment-393643316","issue_url":"https://api.github.com/repos/tgriesser/knex/issues/949","id":393643316,"node_id":"MDEyOklzc3VlQ29tbWVudDM5MzY0MzMxNg==","user":{"login":"elhigu","id":696345,"node_id":"MDQ6VXNlcjY5NjM0NQ==","avatar_url":"https://avatars3.githubusercontent.com/u/696345?v=4","gravatar_id":"","url":"https://api.github.com/users/elhigu","html_url":"https://github.com/elhigu","followers_url":"https://api.github.com/users/elhigu/followers","following_url":"https://api.github.com/users/elhigu/following{/other_user}","gists_url":"https://api.github.com/users/elhigu/gists{/gist_id}","starred_url":"https://api.github.com/users/elhigu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elhigu/subscriptions","organizations_url":"https://api.github.com/users/elhigu/orgs","repos_url":"https://api.github.com/users/elhigu/repos","events_url":"https://api.github.com/users/elhigu/events{/privacy}","received_events_url":"https://api.github.com/users/elhigu/received_events","type":"User","site_admin":false},"created_at":"2018-05-31T19:05:52Z","updated_at":"2018-05-31T19:05:52Z","author_association":"COLLABORATOR","body":"@maxbogue because we cannot make wrapper to every function of every dialect.\r\n\r\n```js\r\nconst subQuery = knex('options').where('customer_id', knex.raw('??', ['customer.id']).limit(1);\r\nknex('customers').select('id', 'name',  knex.raw('exist(?) as ??', [subQuery, 'isEditor'])).this(...\r\n```\r\n\r\nis currently nicest syntax for  this."}}
{"actor":{"display_login":"elhigu"}}