我如何从中选择数据 [英] how can i select data from

查看:55
本文介绍了我如何从中选择数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有三个桌子

Tbl_Auction
A_id,
Pro_id,
状态(``L'',``F'',``C'')

Tbl_BidPlace
BP_id,
Pro_id,
L_id

i have three table

Tbl_Auction
A_id,
Pro_id,
Status (''L'',''F'',''C'')

Tbl_BidPlace
BP_id,
Pro_id,
L_id

if data in Tbl_Auction
--------
1 1 L
2 2 F
3 3 C
4 4 L
5 5 L
6 6 L





data in Tbl_BidPlace
----------------------
1  4  1
2  2  1
3  4  2
4  4  1
5  3  2
6  2  2
7  4  1
8  1  1
9  1  2
10 5  1
11 6  1
12 2  1




现在我想要盖子1的数据
数据应为

孔盖的孔产品标价计数




now i want data for for Lid 1
data should be

count number of bid placed on perticular product for perticular Lid

Pro_id,  PlacedBid
    1          1
    4          3
    5          1
    6          1


我无法解决此SQL查询
请帮忙....

谢谢您.


i can not solve this SQL query
please help....

thank you

推荐答案

select a.Pro_Id,count(BP.Bidplace_id)
    from TBl_Auction a,Tbl_BidPlace BP
    where IsAuction='L' and
    a.Pro_Id=BP.Pro_id and
    BP.L_id=4
    group by a.Pro_Id



选择一个Pro_Id,count(BP.Bidplace_id)
来自TBl_Auction的内部联接Tbl_BidPlace BP on
a.Pro_Id = BP.Pro_id
其中IsAuction =''L''和
BP.L_id = 4
按a.Pro_Id分组
祝你好运
Hey,
select a.Pro_Id,count(BP.Bidplace_id)
from TBl_Auction a inner join Tbl_BidPlace BP on
a.Pro_Id=BP.Pro_id
where IsAuction=''L'' and
BP.L_id=4
group by a.Pro_Id
Best luck


这篇关于我如何从中选择数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆