-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Closed
Description
Issue type:
[ ] question
[ ] bug report
[x] feature request
[ ] documentation issue
Database system/driver:
[ ] cordova
[ ] mongodb
[ ] mssql
[x] mysql / mariadb
[ ] oracle
[ ] postgres
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo
TypeORM version:
[x] latest
[ ] @next
[ ] 0.x.x (or put your version here)
Feature request:
Looks like EXISTS is optimised more, if you need to check only rows existence.
So, instead of
SELECT COUNT(*) FROM mytable WHERE a = "foo" AND b = "bar";better do
SELECT EXISTS(SELECT * FROM mytable WHERE a = "foo" AND b = "bar");But now query builder doesn't support such kind of queries, you need to write a raw query.
I think it would be cool to have something like
queryBuilder()
.select('*')
.from(MyTable, 'tbl')
.where('tbl.a = :foo AND tbl.b = :bar', { foo, bar })
.isExists(); // <-- this rowwyattis, cygwin255, anton-tiptyuk, nikolovjd, kik4 and 77 moreIllicitus, Juraj-Masiar, ValentinVignal, tofran and VolodymyrMordas