You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: manual/english/Searching/Joining.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -996,9 +996,11 @@ Distributed tables consisting only of local tables are supported on both the lef
996
996
997
997
When using JOINs in Manticore Search, keep the following points in mind:
998
998
999
-
1. **Field selection**: When selecting fields from two tables in a JOIN, do not prefix fields from the left table, but do prefix fields from the right table. For example:
999
+
1. **Field selection**: When selecting fields from two tables in a JOIN, prefix fields from the right table with the table name. Left table fields can be used with or without the table prefix. For example:
1000
1000
```sql
1001
1001
SELECT field_name, right_table.field_name FROM ...
1002
+
-- or with left table prefix:
1003
+
SELECT left_table.field_name, right_table.field_name FROM ...
1002
1004
```
1003
1005
1004
1006
2. **JOIN conditions**: Always explicitly specify the table names in your JOIN conditions:
Copy file name to clipboardExpand all lines: manual/russian/Searching/Joining.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -996,9 +996,11 @@ POST /search
996
996
997
997
При использовании JOIN в Manticore Search учитывайте следующие моменты:
998
998
999
-
1. **Выбор полей**: При выборе полей из двух таблиц в JOIN не используйте префикс для полей из левой таблицы, но используйте префикс для полей из правой таблицы. Например:
999
+
1. **Выбор полей**: При выборе полей из двух таблиц в JOIN добавляйте префикс имени таблицы к полям из правой таблицы. Поля левой таблицы можно использовать как с префиксом таблицы, так и без него. Например:
1000
1000
```sql
1001
1001
SELECT field_name, right_table.field_name FROM ...
1002
+
-- or with left table prefix:
1003
+
SELECT left_table.field_name, right_table.field_name FROM ...
1002
1004
```
1003
1005
1004
1006
2. **Условия JOIN**: Всегда явно указывайте имена таблиц в ваших условиях JOIN:
sError.SetSprintf ( "table %s: unknown column: %s (do not prefix left table attributes in JOIN queries, use '%s' instead of '%s')", sLeftTableName.cstr(), sAttrName.cstr(), sAttrName.cstr(), tFilter.m_sAttrName.cstr() );
1694
-
returnfalse;
1692
+
// Allow left table prefix: strip it so the rest of the pipeline sees bare attribute names
0 commit comments