Open 276397082 opened 1 year ago
sql语句中所有的表名称前面都得加上数据库名称才行,
OK语句
select
id,
created_at,
updated_at,
name,
category_type,
use_default_eula,
eula_text,
require_acceptance,
checkin_email,
image,
(
select
count(*)
from
snipeit.accessories
where
categories.id = accessories.category_id
and accessories.deleted_at is null) as accessories_count,
(
select
count(*)
from
snipeit.consumables
where
categories.id = consumables.category_id
and consumables.deleted_at is null) as consumables_count,
(
select
count(*)
from
snipeit.components
where
categories.id = components.category_id
and components.deleted_at is null) as components_count,
(
select
count(*)
from
snipeit.licenses
where
categories.id = licenses.category_id
and licenses.deleted_at is null) as licenses_count,
(
select
count(*)
from
snipeit.assets
inner join snipeit.models on
models.id = assets.model_id
where
categories.id = models.category_id
and exists (
select
*
from
snipeit.status_labels
where
assets.status_id = status_labels.id
and status_labels.archived = 0
and status_labels.deleted_at is null)
and assets.deleted_at is null
and models.deleted_at is null) as assets_count
from
snipeit.categories
where
categories.deleted_at is null
order by
assets_count asc
limit 20 offset 0
报错语句1
select
`id`,
`created_at`,
`updated_at`,
`name`,
`category_type`,
`use_default_eula`,
`eula_text`,
`require_acceptance`,
`checkin_email`,
`image`,
(
select
count(*)
from
`accessories`
where
`categories`.`id` = `accessories`.`category_id`
and `accessories`.`deleted_at` is null) as `accessories_count`,
(
select
count(*)
from
`consumables`
where
`categories`.`id` = `consumables`.`category_id`
and `consumables`.`deleted_at` is null) as `consumables_count`,
(
select
count(*)
from
`components`
where
`categories`.`id` = `components`.`category_id`
and `components`.`deleted_at` is null) as `components_count`,
(
select
count(*)
from
`licenses`
where
`categories`.`id` = `licenses`.`category_id`
and `licenses`.`deleted_at` is null) as `licenses_count`,
(
select
count(*)
from
`assets`
inner join `models` on
`models`.`id` = `assets`.`model_id`
where
`categories`.`id` = `models`.`category_id`
and exists (
select
*
from
`status_labels`
where
`assets`.`status_id` = `status_labels`.`id`
and `archived` = 0
and `status_labels`.`deleted_at` is null)
and `assets`.`deleted_at` is null
and `models`.`deleted_at` is null) as `assets_count`
from
`categories`
where
`categories`.`deleted_at` is null
order by
`assets_count` asc
limit 20 offset 0
报错语句2
select
`id`,
`created_at`,
`updated_at`,
`name`,
`category_type`,
`use_default_eula`,
`eula_text`,
`require_acceptance`,
`checkin_email`,
`image`,
(
select
count(*)
from
`snipeit.accessories`
where
`categories`.`id` = `accessories`.`category_id`
and `accessories`.`deleted_at` is null) as `accessories_count`,
(
select
count(*)
from
`snipeit.consumables`
where
`categories`.`id` = `consumables`.`category_id`
and `consumables`.`deleted_at` is null) as `consumables_count`,
(
select
count(*)
from
`snipeit.components`
where
`categories`.`id` = `components`.`category_id`
and `components`.`deleted_at` is null) as `components_count`,
(
select
count(*)
from
`snipeit.licenses`
where
`categories`.`id` = `licenses`.`category_id`
and `licenses`.`deleted_at` is null) as `licenses_count`,
(
select
count(*)
from
`snipeit.assets`
inner join `snipeit.models` on
`models`.`id` = `assets`.`model_id`
where
`categories`.`id` = `models`.`category_id`
and exists (
select
*
from
`snipeit.status_labels`
where
`assets`.`status_id` = `status_labels`.`id`
and `archived` = 0
and `status_labels`.`deleted_at` is null)
and `assets`.`deleted_at` is null
and `models`.`deleted_at` is null) as `assets_count`
from
`snipeit.categories`
where
`categories`.`deleted_at` is null
order by
`assets_count` asc
limit 20 offset 0
如果你的数据源连接指定了默认数据库,那表名前就不需要加数据库名,如果没有,那当然要加数据库名,这和Datart程序无关
Datart版本号 datart-server-1.0.0-rc.2-install.zip
错误描述 执行错误 No database selected
如何重现 重现错误的步骤,例如:
期望结果 怎么解决
截图
运行环境详情:(可选,取决于错误发生的具体位置)