Дерево страниц
Skip to end of metadata
Go to start of metadata

Вы просматриваете старую версию данной страницы. Смотрите текущую версию.

Сравнить с текущим просмотр истории страницы

« Предыдущий Версия 16 Следующий »

Описаны наиболее востребованные блоки SQL-запросов, для получения данных из атрибутов

Статус

ДОРАБОТКА

Раздел


Кастомный атрибут основных объектов

ЗначенияSQL - запрос

Текст

tn_field_string
select tfs."value" as v
from tn_field_string tfs
join tn_field tf on tf.id = tfs.id
where tf.owner = rkkbase.id and tf.owner_type = rkkbase.id_type and tf.cmjfield = '{storage-field name}'

Число

tn_field_decimal
select tfd."value" as v
from tn_field_decimal tfd
join tn_field tf on tf.id = tfd.id 
where tf.owner = rkkbase.id and tf.owner_type = rkkbase.id_type and tf.cmjfield = '{storage-field name}'

Дата

tn_field_dateonly
select tfs."value" as v
from tn_field_dateonly tfd
join tn_field tf on tf.id = tfd.id
where tf.owner = rkkbase.id and tf.owner_type = rkkbase.id_type and tf.cmjfield = '{storage-field name}'

Время

tn_field_timeonly
select tfs."value" as v
from tn_field_timeonly tft
join tn_field tf on tf.id = tft.id
where tf.owner = rkkbase.id and tf.owner_type = rkkbase.id_type and tf.cmjfield = '{storage-field name}'

Дата и время

tn_field_datetime
select tfs."value" as v
from tn_field_datetime tfdt
join tn_field tf on tf.id = tfdt.id
where tf.owner = rkkbase.id and tf.owner_type = rkkbase.id_type and tf.cmjfield = '{storage-field name}'

Субъект СО

tn_field_string
coalesce(select string_agg(SPLIT_PART(tfs.value, '%', 1),',') as v
 			from tn_field_string tfs
 			join tn_field tf on tf.id = tfs.id
 			where tf.owner = rkkbase.id and tf.owner_type = rkkbase.id_type and tf.cmjfield = '{storage-field name}'),'Не указано')

Таблица

tn_field_string
coalesce((select tfs.value
       		from tn_field_string tfs
       		join tn_field tf on tf.id = tfs.id
       		where tf.owner = rkkbase.id and tf.owner_type = rkkbase.id_type 
			and tf.cmjfield ='{storage-field name}' and tf.idx = 0), '<Не указано>') as receiveWay


Атрибут комплексного справочника

Все атрибуты комлескного справочника текстовые.

ЗначенияSQL - запрос

Текст

classifier_complex
(select title from classifier_complex where classifier_complex.id = (
      					select complex1.id
						from clscom_tag tag1
						left join clscom_to_tag to_tag1 on to_tag1.tag = tag1.id
						left join classifier_complex complex1 on complex1.id = to_tag1.classifier
						left join cls_typeComp typecom1 on typecom1.id = complex1.owner
						where tag1.schema = 'ComplectClassifierWP'
						and typecom1.alias = '{storage-field name}' and tag1.id = tag.id)) as Office

{storage-field name} - название св-ва схемы

  • Нет меток