Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0959f64

Browse files
add intersect_select() method
1 parent 4bccfff commit 0959f64

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

‎simple_query_builder/querybuilder.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,17 @@ def intersect(self):
668668
self._sql += " INTERSECT "
669669
return self
670670

671+
def intersect_select(self, table: Union[str, list, dict]):
672+
if not table:
673+
self.set_error(f"Empty table in {inspect.stack()[0][3]} method")
674+
return self
675+
676+
self._concat = True
677+
fields = self._fields if self._fields else '*'
678+
self._sql += f" INTERSECT SELECT {self._prepare_aliases(fields)} FROM {self._prepare_aliases(table)}"
679+
680+
return self
681+
671682
def __str__(self):
672683
return self.get_sql(False)
673684

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /