Find Jobs
Hire Freelancers

Correct or provide a correct SQL statement for grouping data from single table.

£10-20 GBP

已完成
已发布将近 6 年前

£10-20 GBP

货到付款
I have a table that has 5 fields. MyTable (ts int, pid int, pfc int, psc int, spt int) The table stores unique records. I mean no record will present in the table twice. The stored data essentially is grouped by the "ts" field. I mean all the records that have the same "ts" value can be considered a single group. The task is to write a SQL statement in such a way that we find the frequency of the records with respect to a single group and with respect to the entire groups. For example: If we have this records: INSERT INTO MyTable VALUES (10, 1, 0, 0, 0) ; INSERT INTO MyTable VALUES (10, 1, 0, 0, 0) ; INSERT INTO MyTable VALUES (10, 1, 0, 0, 1) ; INSERT INTO MyTable VALUES (10, 1, 0, 0, 1) ; INSERT INTO MyTable VALUES (10, 1, 1, 0, 1) ; INSERT INTO MyTable VALUES (11, 1, 0, 0, 1) ; INSERT INTO MyTable VALUES (11, 1, 0, 0, 1) ; INSERT INTO MyTable VALUES (11, 1, 0, 0, 1) ; INSERT INTO MyTable VALUES (11, 1, 0, 2, 0) ; INSERT INTO MyTable VALUES (11, 1, 0, 2, 0) ; The final result of the desired SQL statement is ts | pid | pfc | psc | spt | thiscount | accmulatedcount 10 | 1 | 0 | 0 | 0 | 2 | 2 10 | 1 | 0 | 0 | 1 | 2 | 2 11 | 1 | 0 | 0 | 1 | 3 | 5 <-- because we have 2 in the 10 group 11 | 1 | 0 | 2 | 0 | 2 | 2 11 | 1 | 1 | 0 | 1 | 0 | 1 <-- NOTICE: thiscount =0 because no reletive record in the group 11 HOEVER the "accmulatedcount" reveals the "1" from the previous records in any. If we have more than groups then we should do the same with them. For a clear example please see the attached image.
项目 ID: 17525236

关于此项目

17提案
远程项目
活跃6 年前

想赚点钱吗?

在Freelancer上竞价的好处

设定您的预算和时间范围
为您的工作获得报酬
简要概述您的提案
免费注册和竞标工作
颁发给:
用户头像
£21 GBP 在1天之内
4.9 (13条评论)
4.3
4.3
17威客以平均价£17 GBP来参与此工作竞价
用户头像
Hello There, I have been working with postgresql, sql, sqlite since last 4+ years. I can do your project. I would like to do your project. Message me for more details.
£13 GBP 在1天之内
4.6 (9条评论)
3.6
3.6
用户头像
I have more than 3 years of experience working with databases such as oracle and MSSQL with complex queries
£18 GBP 在1天之内
0.0 (0条评论)
0.0
0.0
用户头像
hello sir, I have great knowledge in core development and more than 4 year experience. also I can do your task in few hours. thanks
£13 GBP 在1天之内
0.0 (0条评论)
0.0
0.0
用户头像
I have done task like this before. I can do it confidently. To write the query so that you will get count of repeated int in column and complete table, I have syntax ready.
£18 GBP 在1天之内
0.0 (0条评论)
0.0
0.0
用户头像
Hey I have read & understood your requirements. I have already done similar kind of jobs. I have plenty of time available with me. So i hope you will open a PM for discussion. Thanks Parmod
£18 GBP 在1天之内
0.0 (0条评论)
0.0
0.0
用户头像
hi I am experienced developer and i need good feed back because i am new to freelancers. i m bidding very low for feedback only.
£13 GBP 在1天之内
4.4 (1条评论)
0.0
0.0
用户头像
Hello there i have been working on tsql from a long I believe i can do your task real quick.
£21 GBP 在2天之内
0.0 (0条评论)
0.0
0.0
用户头像
Hi there, I have right experience to do this job. Do inbox me for further discussion. I am working on sql server from 4 years. Thanks
£18 GBP 在1天之内
0.0 (0条评论)
0.0
0.0

关于客户

UNITED KINGDOM的国旗
SWANSEA, United Kingdom
5.0
3
付款方式已验证
会员自7月 29, 2018起

客户认证

谢谢!我们已通过电子邮件向您发送了索取免费积分的链接。
发送电子邮件时出现问题。请再试一次。
已注册用户 发布工作总数
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
加载预览
授予地理位置权限。
您的登录会话已过期而且您已经登出,请再次登录。