avatar
d*r
1
One table has "origin", "dest", "date", "type",
actually one the same day, from origin to destination there are type 1,2,
and 4.
I would like to pick up those records that on that day, on that route,
only type 4 happens. I want to just use one query to implement it.
Please advise me, thanks.
avatar
m*y
2
SELECT *
FROM
WHERE date=
AND origin=
AND dest=
AND type=4
avatar
j*w
3
你这个不保证那天只有4阿

【在 m******y 的大作中提到】
: SELECT *
: FROM
: WHERE date=
: AND origin=
: AND dest=
: AND type=4

avatar
t*g
4
oracle?
select date, origin, dest from table where type = 4 group by date, orgin,
dest
minus
select date, origin, dest from table where type <> 4 group by date, orgin,
dest

【在 d******r 的大作中提到】
: One table has "origin", "dest", "date", "type",
: actually one the same day, from origin to destination there are type 1,2,
: and 4.
: I would like to pick up those records that on that day, on that route,
: only type 4 happens. I want to just use one query to implement it.
: Please advise me, thanks.

avatar
j*w
5
select * from table_name a where
not exist (select * from table_name b where type in (1,2) and
a.origin=b.origin and a.dest = b.dest and a.date=b.date)

【在 d******r 的大作中提到】
: One table has "origin", "dest", "date", "type",
: actually one the same day, from origin to destination there are type 1,2,
: and 4.
: I would like to pick up those records that on that day, on that route,
: only type 4 happens. I want to just use one query to implement it.
: Please advise me, thanks.

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。