小编Gov*_*apa的帖子

如果另一个表中存在满足特定条件的值,我如何才能在一个表中获取 Y 或 N 值?

我必须从三个名为客户、产品和订单的表生成简单的报告。我的报告应该有一栏显示客户是否订购了该产品。如何根据带有产品 ID 的订单中存在的客户 ID 获取 Y 或 N 值?数据示例表如下:

customer                
customer_id name    address phone   
123 govinda nepal   16910833    
234 arjun   nepal   15546235    

product             
product_id  name    brand   type    price
1   samsung gayalexy s5 samsung smartphone  55000
2   samsung gayalexy s6 samsung smartphone  65000

order               
date    product_id  customer_id     
1/1/2016    1   123     
5/1/2016    2   123     
Run Code Online (Sandbox Code Playgroud)

并希望报告栏如下

cust_id    name      product_id    order_stat
Run Code Online (Sandbox Code Playgroud)

order_stat 应为 Y 或 N。

oracle join

2
推荐指数
1
解决办法
2151
查看次数

标签 统计

join ×1

oracle ×1