由买买提看人间百态

topics

全部话题 - 话题: userid
1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
t********y
发帖数: 801
1
来自主题: FleaMarket版 - 【+】userid
对方ID:
Userid
Feedback (+/-/0):
+
具体交易内容:
forever stamp
我的评价:
quick pay, nice buyer
w*******y
发帖数: 183
2
来自主题: FleaMarket版 - [+] UserID
对方ID:
UserID
Feedback (+/-/0):
+
具体交易内容:
FYE GC
我的评价:
smooth transaction. Hope to do business later again.
b******n
发帖数: 2114
3
来自主题: FleaMarket版 - [+] UserID
对方ID:
UserID
Feedback (+/-/0):
+
具体交易内容:
gift card
我的评价:
easy transaction
交易原始贴链接:
t********5
发帖数: 274
4
来自主题: DotNet版 - 求救一个小问题
我也认为是button的事件里写的
可是我找不到那个button相关的任何代码
是flash,整个页面主要都是flash的,我以前没接触过flash方面的编程,不知道您有
没有什么猜想,我顺着路子去找一找
table.aspx页面,就是有聊天窗口,有send按钮的这个页面
<%@ Page Title="" Language="VB" MasterPageFile="~/Shared/xxxx.master"
AutoEventWireup="false"
CodeFile="table.aspx.vb" Inherits="VNT_table" %>
"Server">

阅读全帖
i*****w
发帖数: 75
5
来自主题: Database版 - 来做sql题目。
Try this:
DECLARE @tbl Table (userID int , StartDT datetime, EndDT datetime)
INSERT INTO @tbl (userID, StartDT, EndDT)
Select 1, '12/02/2011', '01/16/2012'
UNION ALL
Select 1, '03/04/2012', '03/24/2012'
UNION ALL
Select 1, '04/05/2012', '04/26/2012'
UNION ALL
Select 1, '05/14/2012', '06/07/2012'
UNION ALL
Select 2, '03/05/2012', '03/30/2012'
UNION ALL
Select 2, '08/04/2012', '09/15/2012'
UNION ALL
Select 2, '04/01/2012', '04/30/2012'
UNION ALL
Select 3, ... 阅读全帖
t****n
发帖数: 10724
6
来自主题: Database版 - 来做sql题目。
借idtknow的思路,改进一下。比较不同行的日期,而不是同一行的日期。希望没有虫子
SELECT userID, StartDT, EndDT,
ROW_NUMBER() OVER (partition by userID order by StartDT) rk,
DATEDIFF(dd, StartDT, EndDT) diff
into #ttt
FROM #tbl
SELECT a.userID, a.rk, a.StartDT as A_Start, a.EndDT as A_End, b.StartDT as
B_Start, b.EndDT as B_End
into #shift
FROM #ttt a
LEFT JOIN #ttt b on a.userID = b.userID and a.rk + 1 = b.rk
order by a.userID, a.rk
select userID, min(A_Start)as StartDate, max(case when B_End IS null or
Cat= 'Y' then A_End else B_E... 阅读全帖
S*******0
发帖数: 198
7
来自主题: JobHunting版 - 贡献邮件面试题(Web Development)
1. Deadlock describes a situation that two or more threads (processes) are
blocked forever, waiting for each other.
Causes: one thread needs to visit the resource that another thread is
possessing and vice versa.
Effects: If deadlock happens, the threads involved will hang there forever
in an undesired status. Deadlock should be avoided.
2.
public ArrayList getToyotas(ArrayList cars)
{
if(cars == null) return null;

ArrayList toyotas = new ArrayList();
for ... 阅读全帖
d*******n
发帖数: 109
8
来自主题: Database版 - 紧急求助, 关于SQL Server
create table table1 (id int , description varchar(20))
insert into table1 values (1, '0-2')
insert into table1 values (2, '2-5')
insert into table1 values (3, '5-10')
insert into table1 values (4, 'more than 10')
create table table2 (userid int, id int)
insert into table2 (userid, id) values (1,1)
insert into table2 (userid, id) values (2,NULL)
insert into table2 (userid, id) values (3,4)
insert into table2 (userid, id) values (4,3)
insert into table2 (userid, id) values (5,NULL)
insert into tab... 阅读全帖
r*****n
发帖数: 92
9
来自主题: DotNet版 - Newbie ASP.NET question
I used sqlhelper class from Application block.
"ses" is my session variable class and ses.s is temporary session variable.
below is the code:
/*method validUserID is to verify id*/
Public Shared Function validUserID(ByVal userid As String) As Boolean
ses.s = (SqlHelper.ExecuteScalar(db.db_connection, CommandType.
StoredProcedure, sp.dptValidateUserID, New SqlParameter("@Userid", userid)))
db.CloseIfOpen()
If userid = ses.s Then
ses.UserId = userid
... 阅读全帖
i****a
发帖数: 36252
10
来自主题: Database版 - 求教一条MS SQL语句
DECLARE @UserID AS INT
DECLARE @UserName AS VARCHAR(50)
SET @UserID = 3
SELECT @UserName = UserName
FROM dbo.[User]
WHERE UserID = @UserID
SELECT gm.GroupID
, @UserID AS UserID
, MAX(g.GroupName) AS GroupName
, COUNT(1) AS cnt
, @UserName AS CreatorName
FROM dbo.GroupMember gm
INNER JOIN dbo.[Group] g
ON gm.GroupID = g.GroupID
WHERE gm.GroupID IN ( SELECT GroupID
FROM dbo.GroupMember
WHERE Use... 阅读全帖
y****3
发帖数: 131
11
非常感谢各位的指点。
我最后的design是:
/****** Object: Table [dbo].[Users] ******/
CREATE TABLE [dbo].[Users](
[UserID] [int] NOT NULL,
[UserName] [varchar](256) NOT NULL,
PRIMARY KEY CLUSTERED
(
[UserID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF
, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
/****** Object: Table [dbo].[Directories] ******/
CREATE TABLE [dbo].[Directories](
[DirectoryID] [bigint] NOT NULL,
[UserId] [int... 阅读全帖
w****w
发帖数: 521
12
来自主题: Database版 - 来做sql题目。
把老祖宗解答放这里压阵,不精版理不容啊。
把同组的EndDate都设成同一个,再挑最小的StartDate。
--------------------------------------
select UserId,min(StartDate) as StartDate, EndDate
from
(select UserId,StartDate,
(select min(EndDate)
from work_time B
where A.UserId=B.UserId and A.StartDate<=B.StartDate
and not exists
(select *
from work_time C where B.UserId=C.UserId and B.StartDate StartDate
and datediff(day,B.EndDate,C.StartDate)<30)
... 阅读全帖
V****r
发帖数: 925
13
来自主题: JobHunting版 - 一个 sql 题目
Select distinct(friendid)
from users u
join friends f on u.userid = f.userid
where u.userid = xxxxxxx
and u.zipcode = xxxxxxx
话说TABLE users 的primary key是userid吧? 那么zipcode可以不用管:
Select distinct(friendid)
from users u
join friends f on u.userid = f.userid
where u.userid = xxxxxxx
B*****g
发帖数: 34098
14
1. check if table2, table3 has primary key userid.
if not, add.
2.
insert into tables1(userid, nickname, msn)
select a.userid, a.nickname, b.msn
from table2 a, table3 b
where a.userid = b.userid.
1. check if table1 has primary key userid.
if not, add.
Note: IF userid is not unique in table 2, table3, kick the person who design
these tables.

records
first
n****e
发帖数: 1403
15
来自主题: Database版 - 请教个SQL问题
select distinct userid
from thisTable t1
where exists(select * from thisTable t2 where t2.userid = t1.userid and t2.
region = 'B' )
and exists(select * from thisTable t2 where t2.userid = t1.userid and t2.
region = 'C' )
and not exists(select * from thisTable t2 where t2.userid = t1.userid and
t2.region not in ('B','C') )
z***e
发帖数: 5393
16
来自主题: Programming版 - Best practice for updating user data?
哦,我没说清楚。network server是接受网络用户请求(比如要update数据),
data server就是存放用户信息(in memory)的server.
每个user对应的server不是固定的,根据条件变化。
我拿wow来打个比方吧,比如一个场景/区域中所有用户都在server 1上,现在有很多
用户非常频繁地切换场景,他的数据就会在server 1/2/3/...上频繁转移。那么我给出一个user
id,要查他在那个地方,就要有一个hashtable/map来存。每次用户的区
域变化了,就会改变server_id.
然后在每个server上,又有这样的东西,这个server还有别的
数据结构,比如当前区域所有玩家列表,就会是一个[userid,userid,userid,...]这样的
list。
所以这个问题是,我要能快速根据userid找到对应的server_id,又要能快速通过
server_id找到在这个server上的所有user.大概是这样。

server.
userid%... 阅读全帖
S*******0
发帖数: 198
17
来自主题: JobHunting版 - 贡献邮件面试题(Web Development)
Web development职位,不是很大的公司,先发邮件来做题,第一次碰到。
刚刚做完,过会发我的sample答案上来
1. Describe a deadlock. What causes it? What are the effects?
2. Consider class Car with method getMake() -> String. Write a function to
retrieve all Toyotas from the following data structure:
ArrayList cars
3. List the bugs/problems in the following code snippets:
a. select * from claim where diagnosis_id in (739.1) and where patient_id in
(select patient_id from patient where name is ‘SMITH’)
b.with a as (select * from claim)
s... 阅读全帖

发帖数: 1
18
来自主题: JobHunting版 - 一个 sql 题目
两个表,
users: userid, username, zipcode
friends: userid, friendid (also an userid), friendname
找出一个 user 的所有在某个 zipcode 的 friends id.
我想出来的答案:
select userid, zipcode from users A where A.userid in (select friendid from
friends B where B.userid = "****") and A.zipcode = "***";
大家觉得这个答案如何?
B*****g
发帖数: 34098
19
SELECT CASE
WHEN a.userid IS NULL
THEN b.userid
ELSE a.userid
END AS userid,
a.nickname,
b.msn
FROM table2 a FULL OUTER JOIN table3 b ON a.userid = b.userid
b********2
发帖数: 855
20
来自主题: Database版 - 求教一条MS SQL语句
GroupMember Table结构请见图片1。
其中,GroupMemberID是PK。UserID是FK。
我想实现的功能。
UserID=3,作为一个输入的变量,然后列出该用户所在的所有Group,并且统计该Group里
相关的人数。
前半部分,也就是显示该用户所在的所有Group我已经解决,因为这个最容易。但是如
何显示出相关的人数,这个部分真的让我非常非常的抓狂啊。。。
我瞎写了一小段代码,请高手们指教。
SELECT COUNT(UserID) AS Counter
FROM GroupMembers
GROUP BY UserID
运行以上代码,可以显示出TABLE里所有不同的GROUP的人数。
但是如果我这样写。
SELECT COUNT(UserID) AS Counter
FROM GroupMembers
WHERE UserID=3
GROUP BY GroupID
结果就是错误的。。。。
毕竟不是专业DBA。。。。郁闷死我了。请高手们赐教,万分感谢。
x**n
发帖数: 2
21
发信人: xynn(中华联邦公民), 信区: Forum. 本篇人气: 1
标 题: 身居海外人士应该为提升中华联邦的国际影响而努力
发信站: 小百合BBS (Thu Jun 20 10:00:05 2013)
中华联邦有朝气,不僵化,
致力于通过赎买还权于民,
在设法保护所有人的利益与社会正义之间的获得平衡,
能使所有中国人各得其所,各安其所,
是所有华人的精神家园,
中华联邦将允许多重国籍,
因为中华联邦的终极目标就是建立全球政府,实现世界大同,
所以有其他国籍的华人也将可以以中华联邦公民的身份为国效力,
正因为中华联邦是所有华人的家园,
海外华人也有义务在各种场合宣传中华联邦,
努力提升中华联邦的国际地位和影响力,
中华联邦架构由江苏最先提出,
江苏政府是中华联邦的发起者和协调者,
中华联邦方案基础性文件:
(1)中华联邦宪法:http://lilybbs.us/vd353951/blogcon?userid=xynn&file=1354891010
(2)向中国共产党赎回民主自由权的赎买方案:http://lilybbs.us/vd353951/blogcon?userid=... 阅读全帖
K**********i
发帖数: 22099
22
来自主题: Military版 - 草,二立真被杀档了,什么情况
他的悲愤程度,连海日都远远不及啊!
身份: [新人]
伪币: 57.34
可用: 57.34
上站次数: [337]
发文数: [2334]
经验值: [6209](天刀)
表现值: [70](优等生)
生命力: [6666]
信箱: [信]
在线状态: 目前不在站上
个人说明档
置顶[120409 9:18PM]▲本人中国科学技术大学(中科大)毕业,学号9300023(少年班
系,零零班),重庆人,左派(非极左),大半个共产主义者,旗帜鲜明的支持重庆模
式、薄熙来、王立军!
[120304 956A]▲http://www.mitbbs.com/article3/Military/37350817_0_tn.html
王立军是真正larger-than-life的大英雄!正式把王立军作为我的榜样和精神导师!不
会因为“王立军事件”未来的任何官方定性、任何铁证、任何……而改变!
[120315]▲昵称改为“政治白痴学研中←位... 阅读全帖
Z**********g
发帖数: 14173
23
来自主题: Military版 - 军版会出陈天华吗?
Neo-警示钟:
置顶[120409 9:18PM]▲本人中国科学技术大学(中科大)毕业,学号9300023(少年班
系,零零班),重庆人,左派(非极左),大半个共产主义者,旗帜鲜明的支持重庆模
式、薄熙来、王立军!
[120304 956A]▲http://www.mitbbs.com/article3/Military/37350817_0_tn.html
王立军是真正larger-than-life的大英雄!正式把王立军作为我的榜样和精神导师!不
会因为“王立军事件”未来的任何官方定性、任何铁证、任何……而改变!
[120315]▲昵称改为“政治白痴学研中←位卑未敢忘忧国”;之前为“位卑未敢忘忧国
”▲ 今晨始“中共”→“土躬”!实在需正式称呼一律称“(当前的)中国执政党”
而不称“中共”,因为它不配!
[120318 9:10AM]▲本人一直以来都block了所有mitbbs上图片,无法通过头像分辩男女
,若以前或之后对女士有粗暴言语,只能在此说声抱歉。当然,即使知道对方性别,也
只影响措辞,不影响立场。
[120318 11:35AM]▲薄熙来王立军重庆模式已经基本肯定会被土... 阅读全帖
s*******y
发帖数: 220
24
来自主题: JobHunting版 - A家 analyst 面经并求建议
SQL比较弱,对于web analytics没有经验。想请教两个问题:
1. 这里的pagenumber是指一个session中访问过的page序列号么?还是等同于page url
来唯一标识一个webpage的?
2. 这个问题怎么写?
找出所有在同一session内访问过page 1在5步之内访问page 2最后又在page 1退出的用
户。
尤其是在page 1退出怎么写呢?
我写了这个query的其他部分,page 1退出这个真不知道怎么写:
SELECT DISTINCT P1.userID
FROM (
SELECT DISTINCT userID, pagenumber, sessionID
FROM visits
WHERE pageurl = url1
) P1
INNER JOIN(
SELECT DISTINCT userID, pagenumber, sessionID
FROM visits
WHERE pageurl = url2
) P2
O... 阅读全帖
y****3
发帖数: 131
25
Again, thank you very much for everyone who kindly helped me in this. I am
already learning a lot as a db design newbie....
Yes, I totally agree with you.
2 is a very interesting point.Sql Server supports varchar(8000), and for
larger data you have to use varchar(max), which may not be in row.
I am thinking about adding a hash column so that I can do easy comparison
and also index.
1. is also very interesting. I am debating if I should add a table to
capture the sub-directory information like ge... 阅读全帖
e****7
发帖数: 4387
26
来自主题: Database版 - 请教个SQL问题
理解错了
 select userid from table
where region = 'b' and userid in (
      select userid from table&
#160;whereregion = 'c'
) and userid not in (
      select userid from table&
#160;whereregion = 'a'
)
c*********e
发帖数: 16335
27
这段angularjs的代码:
var User = $resource('/user/:userId', {userId:'@id'});
var user = User.get({userId:123}, function() {
user.abc = true;
user.$save();
});
这个过程中,总共有2次呼唤http:
第一次,http get,call的 localhost/user/123
就是从服务器端拿到userid 123的user数据:
var user = User.get({userId:123}, function() {
第二次,http post,就是user.$save();但是,这个post的url竟然是
localhost/user/123,不是localhost/user,所以出错。按说,这个save用的url
localhost/user/123其实是update/put(update an existing record)用的url,不是
post(insert a new record)用的url.出错就是出在这儿。... 阅读全帖
l*******P
发帖数: 654
h*****s
发帖数: 733
29
分享李荣浩的单曲《老街》: http://music.163.com/song/133998/?userid=44843191 (来自@网易云音乐)
分享张玮玮和郭龙的单曲《眼望着北方》: http://music.163.com/song/32807844/?userid=44843191 (来自@网易云音乐)
分享低苦艾的单曲《兰州 兰州》: http://music.163.com/song/351059/?userid=44843191 (来自@网易云音乐)
分享郭旭的单曲《不找了》: http://music.163.com/song/29850531/?userid=44843191 (来自@网易云音乐)
多不胜数。
y****3
发帖数: 131
30
【 以下文字转载自 Database 讨论区 】
发信人: yh1213 (yh), 信区: Database
标 题: An interview question: data store schema design
发信站: BBS 未名空间站 (Sat Mar 24 18:30:54 2012, 美东)
Design a backend store for storing metadata about files and directories
belonging to different users as part of an online storage service. The
logical data model is as follows:
--a user has zero or more files or directories
--a directory contains zero or more files or sub-directories
--a file or directory has a relative path that is up to 32K... 阅读全帖
d**e
发帖数: 6098
31
☆─────────────────────────────────────☆
yishan (易山风雨易江秋) 于 (Fri Feb 15 05:35:50 2013, 美东) 提到:
我撕去一小块窗纸,你能看到多远的天?
交流面试的时候,经常有朋友会问一个问题:我正确回答了90%的面试题,为什么被拒?
我们就来探讨这个问题。
先回答我一个问题:假设一次面试满分是100分,你正确回答90%题,该得多少分?
如果你认为该得90分,那说明你还没有理解面试,区分不开面试与考试的区别。考试是
看你是不是合格,面试是要选拔最优。用考试的思维应对面试,哥们儿你南辕北辙了。
现在回答我第二个问题,如果某个职位,有10个人都能正确回答90%题,凭什么要求对
方把offer给你?如果想不通这个问题,那你将来的面试成功率将永远是1/N(N表示竞
争同一个岗位时,与你水平相当的人数)。
你有没有想过,你的竞争对手中,发生如下情况:
- 有人能在满分100的面试中,得到150分,甚至200分
- 有人能把一道10分的题回答成50分
- 有人能用错误的回答,击败你正确的答案
- ... 阅读全帖
m*****u
发帖数: 19562
N**********d
发帖数: 9292
33
来自主题: BuildingWeb版 - about .htaccess
On a server, I have a directory /path/to/my/userId
I have a web directory like /path/to/my/userId/public_html
I can access the index like http://web.domain.edu/~userId/index.html
if I want to install wordpress or something the like into
/path/to/my/userId/public_html/wordpress
is it possible to access the wordpress pages without type the folder
name wordpress in the url?
Any help will be appriciated!
c*****t
发帖数: 1879
34
来自主题: BuildingWeb版 - about .htaccess
It could be possible with regex replacement. I am not an expert, but
you could try something like the following (not tested):
RewriteEngine On
RewriteRule ^/~userId/*$ /~userId/wordpress/index.php?$1 [L,QSA]
so when people tries to access
/~userId/content
it would be forwarded to
/~userId/wordpress/index.php?content
.htaccess documentation is available online, so you can read more about
it.
t*****g
发帖数: 1275
35
来自主题: Database版 - aks a simple SQL question
select t1.userid
from t1 left outer join t2 on t1.userid = t2.userid
where t2.userid is null
c*****d
发帖数: 6045
36
来自主题: Database版 - aks a simple SQL question
nod
should be:
select userid_1
from
(select t1.userid as userid_1, t2.userid as userid_2 from t1 left join t2 on
t1.userid=t2.userid)
where userid_2 is null

你这不对
t*****g
发帖数: 1275
37
来自主题: Database版 - aks a simple SQL question
my query was
select t1.userid
from t1 left outer join t2 on t1.userid = t2.userid
where t2.userid is null
n****u
发帖数: 229
38
Sorry I can not write Chinese here.
In MySQL, I have two databases: newdb and olddb
table1 in newdb, table2 and table3 in olddb
table1 has userid, nickname, msn
table2 has userid, nickname
table3 has userid msn
First I use NaviCat to import table2 into table1, very fast! 320,000 records
in 2 mins!
Then I tried to import table 3 into table1, now I have to check userid first
, then UPDATE table1. Very slow. 50,000 records in 12 hours
Anyway I can make it fast?
Thanks
n****u
发帖数: 229
39
Sorry to bother high hands again. Thanks for your help before!
Table a, articleid (pk), userid, datetime, textbody
Table b, userid (pk), nickname
I want one record, that's the latest article, with nickname, datetime and
textbody.
So I wrote this:
SELECT a.DateTime,b.Nickname,a.textbody
FROM a, b
WHERE a.userid=b.userid
ORDER BY datatime DESC
LIMIT 0, 1
But I feel this might be slow. Any way to make it fast?
I told my team leader we should write this as a stored procedure, but he
refused.
y****3
发帖数: 131
40
Design a backend store for storing metadata about files and directories
belonging to different users as part of an online storage service. The
logical data model is as follows:
--a user has zero or more files or directories
--a directory contains zero or more files or sub-directories
--a file or directory has a relative path that is up to 32KB in length
--a file has a size and last modified time
This store should handle the following online queries efficiently:
--lookups on single files or sub-d... 阅读全帖
l******b
发帖数: 39
41
来自主题: Database版 - 紧急求助, 关于SQL Server

是要这样吗?
With C As(
select description, t2.userid, program
from table1 as t1
left join table2 as t2
on t1.id = t2.id
left join table3 as t3
on t2.userid = t3.userid
)
select description, A, B, C
from C pivot(count(userid) for program in (A, B, C)) as P ;
----------------------------------------------------------
description A B C
---------------------------
0-2 1 0 1
2-5 0 0 0
5-10 0 0 1
more than 10 0 1 0
h****e
发帖数: 2125
42
来自主题: Programming版 - Best practice for updating user data?
hash_map >
typedef hash_map >::iterator itertype;
hash_map
u only need to search userid once to find all user ids on a server. need to
be careful with update methods though. not sure whether this is what u want.
..

出一个user
用户的区
样的
h*****s
发帖数: 733
43
分享痛仰乐队的单曲《再见杰克》: http://music.163.com/song/381821/?userid=44843191 (来自@网易云音乐)
分享撒娇的单曲《在劫难逃 (Only you)》: http://music.163.com/song/292587/?userid=44843191 (来自@网易云音乐)
分享白亮/赵静的单曲《孙大剩》: http://music.163.com/song/32628933/?userid=44843191 (来自@网易云音乐)
b********e
发帖数: 693
44
来自主题: JobHunting版 - Amazon Second phone
1. some basic c++ questions, such as emutable variable, virtual destructor
2. tree
3. hash table vs binary tree, pros and cons
4 . design a library system
5. code implements
has a log file, which include userid, timestamp (when click a link).
All clicks in one hour call one section,
ask find the userid, who has max click in one section.
after this, he asked me how about in distributed system, many machine,
many log files, how to find the userid, who has max clicks in one section
I*********9
发帖数: 15
45
来自主题: JobHunting版 - SQL 面试题 - 请高手指点
2 variables in table1 showing all records of transactions each customer
makes. one customer (usedid 001) may purchase same products (productid Q909)
several times.
table1:
userid productid
001 Q909
001 Q909
001 Q908
002 Q101
Question: use SQL to calculate how many customers purchase only 1 type of
product, 2 types of products, 3...and so on.
for example: if there were 694 unique userid who purchased only 1 unique
productid, 900 unique userid purchased only 2 unique productid, we wan... 阅读全帖
t*****e
发帖数: 1700
46
来自主题: JobHunting版 - SQL 面试题 - 请高手指点
If the system doesn't support distinct count, do the following subquery
Select userid, count(productid) as ProdCount from
(select distinct userid, productid from Table)
group by userid

Q909)
i***e
发帖数: 3
47
来自主题: JobHunting版 - SQL 面试题 - 请高手指点
select NoOfType as number_of_type_product_purchased, count(user) as number_
of_customer
from (
select userid, count(productid) as NoOfType
from (select distinct userid productid
from table1) a
group by userid) a1
group by NoOfType
order by number_of_type_product_purchased
l*****a
发帖数: 559
48
来自主题: JobHunting版 - SQL 面试题 - 请高手指点
SELECT `cnt` AS number_of_type_product_purchased, COUNT(`userid`) AS number_
of_customer FROM
(
SELECT `userid`,COUNT(`productid`) AS cnt FROM `table1`
GROUP BY `userid`
) TMP
GROUP BY `cnt`
t******r
发帖数: 209
49
就是前几天有人贴的这个题吧:
Userid PageID
A 1
A 2
A 3
B 2
B 3
C 1
B 4
A 4
找出最常用的length-3访问序列:对于用户A:1-2-3, 2-3-4 用户B:2-3-4
2-3-4 是最常见的
两个hash,一个user hash,每一项存userid和对应的三连击中的前两个值;一个三连
击hash,存三连击string和count。
对于logfile中的每一行,在这两个hash中查找并更新。如果认为每次hash的复杂度为O
(1),则总的时间复杂度为O(n)。空间复杂度为O(m+k),m为userid的个数,k为不同的三
连击的个数。
s*w
发帖数: 729
50
来自主题: JobHunting版 - 问道算法题
这个没涉及算法啊
直接读文件,每个 userId 直接开个同名文件append pageID 进去
while read line
do
userID=$(echo "$line" | cut -d, -f1)
pageIDVistedByUser=$(echo "$line" | cut -d, -f2)
echo $pageIDVistedByUser >> userID
done < BigFile
1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)