由买买提看人间百态

topics

全部话题 - 话题: id2
1 2 3 4 下页 末页 (共4页)
n******g
发帖数: 17225
1
【 以下文字转载自 Complain 讨论区 】
发信人: TomsnReuters (汤生撸透射), 信区: Complain
标 题: 裸体跪求站方封本id2年时间
发信站: BBS 未名空间站 (Mon Mar 2 09:04:59 2020, 美东)
本id多发了两贴,严重违反菌斑秩序,本人深感后悔, 请求站方从严制版,把本id办2年
多谢!!!!
s*********e
发帖数: 1051
2
来自主题: Statistics版 - R 有点令人失望
> n <- 1000000
> set.seed(2013)
> ldf <- data.frame(id1 = sample(n, n), id2 = sample(n / 100, n, replace =
TRUE), x1 = rnorm(n), x2 = runif(n))
> rdf <- data.frame(id1 = sample(n, n), id2 = sample(n / 100, n, replace =
TRUE), y1 = rnorm(n), y2 = runif(n))
>
> # METHOD 1: MERGE
> system.time(join1 <- merge(ldf, rdf, by = c("id1", "id2")))
user system elapsed
54.028 11.229 65.673
>
> # METHOD 2: PLYR
> # library(plyr)
> # system.time(join2 <- plyr::join(ldf, rdf, by = c("id1", "id2"), type =... 阅读全帖
B*****g
发帖数: 34098
3
来自主题: Database版 - SQL Server query 一问
SELECT a.id1, a.id2, b.ColumnB1, b.ColumnB2, NULL ColumnC1, NULL ColumnC2
FROM A a, B b
WHERE a.id1 = b.id2
AND a.id2 = b.id2
UNION ALL
SELECT a.id1, a.id2, NULL ColumnB1, NULL ColumnB2, ColumnC1, ColumnC2
FROM A a, C c
WHERE a.id1 = c.id2
AND a.id2 = c.id2
有包子吗?
l******9
发帖数: 579
4
【 以下文字转载自 Database 讨论区 】
发信人: light009 (light009), 信区: Database
标 题: SQL combine two tables into one table and add a new column
发信站: BBS 未名空间站 (Thu May 8 14:54:50 2014, 美东)
I need to combine two tables into one. Ans also, add a column (assign an int
value) to the new table on SQL. So that the rows from table1 and ones from
table2 are assigned with different values.
Example,
table1
ID1 ID2 ID3 VALUE
table2
ID1 ID2 ID3 VALUE
table3
ID1 ID2 ID3 VALUE
i need to combine ... 阅读全帖
B*****g
发帖数: 34098
5
来自主题: Database版 - SQL Server query 一问
SELECT a.id1, a.id2, d.ColumnB1, d.ColumnB2, d.ColumnC1, d.ColumnC2
FROM A a,
(SELECT b.id1, b.id2, b.ColumnB1, b.ColumnB2, NULL ColumnC1, NULL ColumnC2
FROM B b
UNION ALL
SELECT c.id1, c.id2, NULL ColumnB1, NULL ColumnB2, ColumnC1, ColumnC2
FROM C c
) d
WHERE a.id1 = d.id2
AND a.id2 = d.id2
d*h
发帖数: 2347
6
来自主题: Database版 - SQL Server query 一问
select A.id1, A.id2, B.ColumnB1 ColumnB1, B.ColumnB2 ColumnB2, NULL as
ColumnC1, NULL as ColumnC2
from table1 A
right join table2 B
on A.id1=B.id1
and A.id2=B.id2
union all
select A.id1, A.id2, NULL as ColumnB1, NULL as ColumnB2, C.ColumnC1 ColumnC1
, C.ColumnC2 ColumnC2
from table1 A
right join table3 C
on A.id1=C.id1
and A.id2=C.id2;
d*h
发帖数: 2347
7
来自主题: Database版 - SQL Server query 一问
select A.id1, A.id2, B.ColumnB1 ColumnB1, B.ColumnB2 ColumnB2, NULL as
ColumnC1, NULL as ColumnC2
from A
right join B
on A.id1=B.id1
and A.id2=B.id2
union all
select A.id1, A.id2, NULL as ColumnB1, NULL as ColumnB2, C.ColumnC1 ColumnC1
, C.ColumnC2 ColumnC2
from A
right join C
on A.id1=C.id1
and A.id2=C.id2;
n******7
发帖数: 12463
8
来自主题: Programming版 - 请教一个query CGI 的问题
需要用一个web server做点计算,但是它不支持batch query,所以写了一个python脚本
来递交查询
第一个server脚本是用post 传参数,还好
import urllib as ul
import urllib2 as ul2
url = 'xxx'
para = {'xx':xx,'yy':yy}
data = ul.urlencode(para)
req = ul2.Request(url, data)
response = ul2.urlopen(req)
从返回的html,可以提取两个内部id,id1和id2的值
第二个脚本用get,传递id1和id2两个参数的值
id1 = 145238
id2 = 153455
final_url = 'http://bioinformatics.clemson.edu/G-
SESAME/Program/geneCompareTwo3.php?id1=%s&id2=%s&Submit=submit' %
(id1,id2)
final_result = ul2.urlopen(final_url)
结果就总是不对,... 阅读全帖
k*****u
发帖数: 1688
9
来自主题: Statistics版 - 一个SAS问题,合并行
抛砖引玉,用一个很繁琐的办法写出来了。呵呵。不过凭感觉,我觉得应该有很简单的
办法。
data a;
input ID Attr1 $ Attr2 $;
cards;
1 A1 B1
1 A2 B2
1 A3 B3
2 A4 B4
3 A5 B5
3 A6 B6
3 A7 B7
3 A8 B8
4 A9 B9
4 A10 B10
;
run;
proc sort data=a;
by id;
run;
data a;
set a;
by id;
retain id2;
if first.id then id2=0;
id2=id2+1;
output;
run;
proc print data=a;
run;
proc sql;
create table temp1 as
select count(1) as cnt
from a
group by id;
select ... 阅读全帖
l******9
发帖数: 579
10
【 以下文字转载自 Statistics 讨论区 】
发信人: light009 (light009), 信区: Statistics
标 题: SQL check likeness between two large tables
发信站: BBS 未名空间站 (Tue May 6 15:38:29 2014, 美东)
I need to check the likeness between two data tables on SQL. I am working on
Aginity Workbench for Netezza on Win 7.
The tables are very large. One of them has 100 million rows and 4 columns;
another one has 1500 million rows and 3 columns.
Example, table1
ID1 ID2 ID3 Value
xxxx xxxxxx xxxxxxxx xxx.xxxxxx ... 阅读全帖
f*****c
发帖数: 166
11
有两台ipad:ipad1,ipad2
ipad1使用apple id:id1
ipad2使用apple id:id2
id1和id2均为email地址。
从iphone使用facetime呼叫id1,ipad1显示被呼叫。
从iphone使用facetime呼叫id2,ipad2显示被呼叫。
但是,如果在ipad1和ipad2上,分别将id1和id2注销,并互换apple id,既:
ipad1 <- id2
ipad2 <- id1
此时,从iphone使用facetime呼叫id1的时候,仍然是ipad1显示被呼叫,而非ipad2.
请问如何解决?
谢谢!
l******9
发帖数: 579
12
【 以下文字转载自 Statistics 讨论区 】
发信人: light009 (light009), 信区: Statistics
标 题: SQL check likeness between two large tables
发信站: BBS 未名空间站 (Tue May 6 15:38:29 2014, 美东)
I need to check the likeness between two data tables on SQL. I am working on
Aginity Workbench for Netezza on Win 7.
The tables are very large. One of them has 100 million rows and 4 columns;
another one has 1500 million rows and 3 columns.
Example, table1
ID1 ID2 ID3 Value
xxxx xxxxxx xxxxxxxx xxx.xxxxxx ... 阅读全帖
l******9
发帖数: 579
13
【 以下文字转载自 Statistics 讨论区 】
发信人: light009 (light009), 信区: Statistics
标 题: SQL check likeness between two large tables
发信站: BBS 未名空间站 (Tue May 6 15:38:29 2014, 美东)
I need to check the likeness between two data tables on SQL. I am working on
Aginity Workbench for Netezza on Win 7.
The tables are very large. One of them has 100 million rows and 4 columns;
another one has 1500 million rows and 3 columns.
Example, table1
ID1 ID2 ID3 Value
xxxx xxxxxx xxxxxxxx xxx.xxxxxx ... 阅读全帖
s*r
发帖数: 2757
14
来自主题: Statistics版 - An interesting question from mysas.net/forum
data a1;
set a1;
uid=_n_;
run;
%macro paircomp(id1, id2);
proc sql;
create table t&id1.&id2. as
select min(b.uid,c.uid) as uid_1, max(b.uid,c.uid) as uid_2
from a1 as b, a1 as c
where b.id&id1=c.id&id2 and b.uid ^= c.uid;
quit;
proc sort data=t&id1.&id2. nodup;
by uid_1;
run;
proc append data=t&id1.&id2. base=allsame force; run;
%mend;
option mlogic mprint spool;
%paircomp(1,1);
%paircomp(1,2);
%paircomp(1,3);
%paircomp(1,4);
%paircomp(2,2);
%paircomp(2,3);
%paircomp(2,4);
%paircomp(3,3);
%pairc
w*****m
发帖数: 414
15
来自主题: Statistics版 - 请教一个sas求和的问题
data是这样的:
year id sequence x
2000 id1 1 ..
2001 id1 2 ..
2002 id1 3 ..
2005 id1 1 ..
2006 id1 2 ..
2001 id2 1 ..
2002 id2 2 ..
2004 id2 1 ..
2007 id2 1 ..
2009 id2 1 ..
2000 id3 1 ..
2001 id3 2 ..
2002 id3 3 ..
2003 id3 4 ..
2004 id3 5 ..
2008 id3 1 ..
sequence 表示一个事件对于同一个对象在几... 阅读全帖
k*******a
发帖数: 772
16
来自主题: Statistics版 - 请教一个sas求和的问题
你可以新建一个变量,把他们group起来
data a;
input year id $ sequence x;
datalines;
2000 id1 1 1
2001 id1 2 2
2002 id1 3 2
2005 id1 1 2
2006 id1 2 3
2001 id2 1 6
2002 id2 2 7
2004 id2 1 1
2007 id2 1 2
2009 id2 1 8
2000 id3 1 9
2001 id3 2 1
2002 id3 3 2
2003 id3 4 3
2004 id3 5 4
2008 id3 1 6
;
data a;
set a... 阅读全帖
a********i
发帖数: 205
17
来自主题: Statistics版 - 请教一个sas求和的问题
data sum;
input year id $ sequence x;
datalines;
2000 id1 1 35
2001 id1 2 60
2002 id1 3 80
2005 id1 1 76
2006 id1 2 95
2001 id2 1 108
2002 id2 2 87
2004 id2 1 76
2007 id2 1 84
2009 id2 1 98
2000 id3 1 123
2001 id3 2 198
2002 id3 3 82
2003 id3 4 90
2004 id3 5 23
2008 id3 1 90
;
run;
... 阅读全帖
l******9
发帖数: 579
18
来自主题: Statistics版 - SQL check likeness between two large tables
I need to check the likeness between two data tables on SQL. I am working on
Aginity Workbench for Netezza on Win 7.
The tables are very large. One of them has 100 million rows and 4 columns;
another one has 1500 million rows and 3 columns.
Example, table1
ID1 ID2 ID3 Value
xxxx xxxxxx xxxxxxxx xxx.xxxxxx // here x is 0-9 int
table2:
ID1 ID2 Value
xxxx xxxxxx xxx.xxxxxx
the ID1 and ID2 may be duplicated but Values are not duplicated in the sam... 阅读全帖
k*****y
发帖数: 744
19
来自主题: JobHunting版 - 一道google 经典题
考虑六种从小到大排列的可能情况,每种找出最小的distance,再一起比较。
import random
# generate random data
data = [[],[],[]]
for i in range(0,3):
N = random.randint(5, 10)
for j in range(0, N):
data[i].append(random.randrange(0, 1000))
data[i].sort()
test_cases = [(0,1,2), (0,2,1),
(1,0,2), (1,2,0),
(2,0,1), (2,1,0)]
pos = [[]]*len(test_cases)
dist = [1000000]*len(test_cases)
def LowerBound(x, queueID, start):
for i in range( start, len(data[queueID]) ):
if data[queu... 阅读全帖
k*****y
发帖数: 744
20
来自主题: JobHunting版 - 一道google 经典题
考虑六种从小到大排列的可能情况,每种找出最小的distance,再一起比较。
import random
# generate random data
data = [[],[],[]]
for i in range(0,3):
N = random.randint(5, 10)
for j in range(0, N):
data[i].append(random.randrange(0, 1000))
data[i].sort()
#=============================
test_cases = [(0,1,2), (0,2,1),
(1,0,2), (1,2,0),
(2,0,1), (2,1,0)]
pos = [[] for i in range(len(test_cases))]
dist = [1000000]*len(test_cases)
def LowerBound(x, queueID, start):
for i in range( st... 阅读全帖
F*******2
发帖数: 371
21
你code得到的是在table1 但是不在table2里面的数据
用下面code可以得到不在A B inner join中的数据:
SELECT A.ID1 AS A_ID1, A.ID2 AS A_ID2, A.ID3 as A_ID3, A.Value AS A_Value,
B.Value AS B_Value, B.ID1 AS B_ID1,B.ID2 AS B_ID2
FROM Table1 AS A
FULL OUTER JOIN Table2 AS B
ON A.ID1 = B.ID1 and A.ID2=B.ID2
WHERE A.ID1 IS NULL
OR B.ID1 IS NULL
Check here:
http://www.codeproject.com/Articles/33052/Visual-Representation
l*********8
发帖数: 4642
22
Use two SQLs:
INSERT INTO new_table
SELECT '80', t2.id2, t3.id3, sum(t1.value * t2.value)
FROM table1 t1
JOIN table2 t2
ON t1.id1 = t2.id1
GROUP BY t2.id2, t2.id3
INSERT INTO new_table
SELECT '81', t3.id2, t3.id3, sum(t1.value * t3.value)
FROM table1 t1
JOIN table3 t3
ON t1.id1 = t3.id1
GROUP BY t3.id2, t3.id3
l********0
发帖数: 283
23
来自主题: Database版 - 请问mysql这个语句如何写?
表是这样的:
id2 id3
1 1
1 2
1 3
2 1
2 3
3 2
4 1
4 2
我想查询这样的数据,就是同时满足id3=x和id3=y的id2
比如id3=1同时id3=2的id2有1,4
比如id3=1同时id3=3的id2有1,2
请问这条语句如何写(mysql)?谢谢!
v***v
发帖数: 267
24
with a1 (ID1,ID2) as ( VALUES ('A', ''), ('B', NULL), ('C', 'A')) select *
from a1 where ID1 not in (select ID2 from a1)
就是想找id1不出现在id2里面的行
事先不知道id2里面有NULL
结果就一行都没选上
s******r
发帖数: 1524
25
来自主题: Statistics版 - help. txt 读入问题
data test;
LENGTH key1 8 key2 8 id1 8 id2 8;
FORMAT key1 BEST6. key2 BEST6. id1 $19. id2 $19.;
INFORMAT key1 BEST6. key2 BEST6. id1 $19. id2 $19.;
INPUT key1 : BEST6. key2 : BEST3. id1 : $19. id2 : $19.;
INFILE datalines DLM='7C'x MISSOVER DSD;
datalines;
18949|21|1942303098494173209 |1368841116323724091
;
run;
n*******w
发帖数: 687
26
来自主题: JobHunting版 - 报面经+offer
要提高communication的确mock interview是很有效的。一般career center都有人提供
这个服务。只要愿意,可以多去预约mock几次。
几个题大概写了下想法。
1. social graph
两个想法。
第一个,允许suboptimal solution的话,用greedy。标准就是前面有人说的,选邻边
的时候,选没有收到消息的邻边最多的那个节点。一个足够scalable的network,这样
做应该能非常接近最优解。
第二个,要最优解得exhaustive遍历了。dfs + backtrace。走到不能走了,记录长度
跟路径。backtrace回去。遍历完所有可能性。
很容易证明,这题用greedy或者dp都不work。
2. search FB status
好像就是google那篇paper里边的那一套,inverted index + map/reduce。先index每
个status中每个关键字,建inverted index。每个关键字可以hash到一个整数上。然后
每个机器负责一个range的关键字。
如果某个range的关键字太多,某个机... 阅读全帖
m*********u
发帖数: 1491
27
SELECT *
FROM
(
SELECT *,'80' as top_id
FROM table1
JOIN
table2
ON table1.id1 = table2.id1
GROUP BY table1.id2, table2.id3
) AS tt_a
union all
(
SELECT *,'81' as top_id
FROM table1
JOIN
table3
ON table1.id1 = table3.id1
GROUP BY table3.id2, table3.id3
) AS tt_b
GROUP BY top_id, id2, id3
f******b
发帖数: 1148
28
难道真的是这样?
我们分别用ID1, ID2 跟自己的 iphone, ipad, pc sync, 但是在安装软件的时候,都
用同一个ID, let's say ID1, sign in and sign out? 但问题是,原来是cloud ID2
的机器,用ID1 sign in 买软件的时候,会不会自动更新成ID1的状态,再sign out 的
时候,自动更新成ID2的状态, which doesn't have that app you were buying...
或者说,每个ID在cloud里都要定义哪几个device是sync的,别的如果要SYNC就要提示
允许还是不允许?
d****o
发帖数: 3
29
来自主题: Database版 - Cascade delete, update 的问题(MS SQL)
有两个table,
table1有ID, Descr两个字段, 其中ID为unique key
table2有ID1, ID2和其他一些字段,其中ID1,ID2都是从table1的ID来的,
想要talbe1.ID有delete, update的时候table2中的ID1, ID2会相应更新,
缺做不了,说会有may cause cycles or multiple cascade paths.
请问,应该怎样解决这个问题呀?
多谢
m**h
发帖数: 69
30
来自主题: Database版 - 问个查询的问题
another option in oracle syntax:
select
nvl((select a.name from a where d.type1='a' and a.id=d.id1),'') ||
nvl((select b.name from b where d.type1='b' and b.id=d.id1),'') ||
nvl((select c.name from c where d.type1='c' and c.id=d.id1),'')
name1
,
nvl((select a.name from a where d.type2='a' and a.id=d.id2),'') ||
nvl((select b.name from b where d.type2='b' and b.id=d.id2),'') ||
nvl((select c.name from c where d.type2='c' and c.id=d.id2),'')
name2
from d
where
.....
;
Warning: will return '' not N
x***e
发帖数: 2449
31
来自主题: Database版 - INSERT or UPDATE, which is faster?
I do not know about that.
I only know it is case by case.
And I am not work for MS either....
I can not image in the following case the update >= insert + delete
in any of the SQL env.
you have a table
Id1, id2, text
while ID1 is unique index, id2 is an int none indexed column and text is a
text column.
and you want to update the id2 column....based on id1....

to
of
t*********i
发帖数: 217
32
来自主题: Database版 - INSERT or UPDATE, which is faster?
Just see your reply :)
for the case you mentioned.
**************************************************
you have a table
Id1, id2, text
while ID1 is unique index, id2 is an int none indexed column and text is a
text column.
and you want to update the id2 column....based on id1....
****************************************************
I still think in Oracle, Update is quicker than delete+insert
in SQL server (and all other DB system that one update = one delete + one
insert), that should be no much
c*****d
发帖数: 6045
33
来自主题: Database版 - 请问mysql这个语句如何写?
select a.id2
from
(select * from tabA where id3=x) as a,
(select * from tabA where id3=y) as b
where a.id2=b.id2
c*********e
发帖数: 16335
34
with a1 (ID1,ID2) as ( VALUES ('A', ''), ('B', NULL), ('C', 'A')) select *
from a1 where ID1 not in (select ID2 from a1 where ID2 IS NOT NULL)

*
l******9
发帖数: 579
35
I need to add a column with an int value to the result from a subquery on
SQL.
It is Netezza SQL.
SELECT *
FROM
(
SELECT *
FROM table1
JOIN
table2
ON table1.id1 = table2.id1
GROUP BY table1.id2, table2.id3
) AS tt_a # here, I need to add a new column to tt, call it as top_id
and also assign an int value to it, such as 80
FROM
(
SELECT *
FROM table1
JOIN
table3
ON table1.id1 = table3.... 阅读全帖
o******n
发帖数: 511
36
工作中碰到的一个问题:
有一个redshift里的表,有如下几个fields,分别是id1, id2, id3, day, users,其
中id1, id2, id3, day是composite key。
我想找出每个id1+id2+id3对应的最近三十天的users。
我知道这个可以用类似于给各部门雇员工资排序的办法用self join。
请问可以用window function做吗?我试过nth_value但报错。应该怎么写完整的query
呢?谢谢。
r*g
发帖数: 3159
37
SELECT *
FROM table1 LEFT OUTER JOIN table2
ON table1.ID1 = table2.ID1 AND table1.ID2 = table2.ID2
WHERE table2.ID1 IS NULL
OR table2.ID2 IS NULL
l******9
发帖数: 579
38
【 以下文字转载自 Database 讨论区 】
发信人: light009 (light009), 信区: Database
标 题: SQL combine two tables into one table and add a new column
发信站: BBS 未名空间站 (Thu May 8 14:54:50 2014, 美东)
I need to add a column with an int value to the result from a subquery on
SQL.
It is Netezza SQL.
SELECT *
FROM
(
SELECT *
FROM table1
JOIN
table2
ON table1.id1 = table2.id1
GROUP BY table1.id2, table2.id3
) AS tt_a # here, I need to add a new column to tt, c... 阅读全帖
j******n
发帖数: 2206
39
来自主题: Statistics版 - 怎么merge on either of the 2 ids? (sas)
a and b has two common ids: id1 and id2.
I want to merge them ,by a.id1=b.id1 or a.id2=b.id2
怎么弄呢?
就比如两个data sets都有社会安全号和date birth, 其中任何一个match,就表明是同
一个人,因为输入的一些失误,同一个人可能有不同的安全号,但是会有一样的date
birth.
这种or的merge条件应该怎么写呢?
G**S
发帖数: 1108
40
来自主题: Statistics版 - 怎么merge on either of the 2 ids? (sas)
proc sql;

a and b has two common ids: id1 and id2.
I want to merge them ,by a.id1=b.id1 or a.id2=b.id2
怎么弄呢?
就比如两个data sets都有社会安全号和date birth, 其中任何一个match,就表明是同
一个人,因为输入的一些失误,同一个人可能有不同的安全号,但是会有一样的date
birth.
这种or的merge条件应该怎么写呢?
m**o
发帖数: 846
41
来自主题: Statistics版 - An interesting question from mysas.net/forum
先按record生成key:
data a1;
set a1;
key=_n_;
run;
再把a1分成4个dataset
data a1_1 a1_2 a1_3 a1_4;
set a1;
output a1_1(keep=key id1);
output a1_2(keep=key id2);
output a1_3(keep=key id3);
output a1_4(keep=key id4);
run;
对a1_1生成最终的ID(unique across id1),然后应用到其他dataset上
proc sort data=a1_1; by id1 key; run;
data a1_1;
set a1_1;
by id1 key;
retain ID;
if first.id1=1 then ID=id1;
run;
把这个新ID merge到id2并使其unique across id2
proc sql;
create table a2 as
select a.*,b.ID
from a1_2 as a inner join a1_1 as b on a.key=b
c**********5
发帖数: 653
42
original data
medicationcalss1 medication calss2 medicationclass3
id1 medication1 1 0 0
id1 medication2 1 0 0
id1 medication3 0 1 0
id2 medication1 1 0 0
id2 medication2 1 0 0
id3 medication4 1 0 0
id3 medicatio... 阅读全帖
h********o
发帖数: 103
43
来自主题: Statistics版 - help. txt 读入问题
Why you use both LENGTH and INFORMAT statements? also you define your ID1,
ID2 variables as character in the INPUT statement, you should use:
length ID1 $8 ID2 $18;
not
length ID1 8 ID2 18;
k*******a
发帖数: 772
44
来自主题: Statistics版 - 请教一个SQL 的问题
A stupid way:
data test;
input Ids $ Status Date mmddyy10.;
datalines;
ID1 4 05/02/2013
ID1 3 05/10/2013
ID1 2 05/16/2013
ID1 1 05/20/2013
ID2 3 05/08/2013
ID2 2 05/10/2013
ID2 1 05/19/2013
;
run;
proc sql;
select distinct Ids,
(select date from test where Ids = a.Ids and status=3) - (
select date from test where Ids = a.Ids and status=4) as chg43 label = "From
4-3 (Days)",
(select date from test where Ids = a.Id... 阅读全帖
l****u
发帖数: 529
45
来自主题: Statistics版 - 求大牛解答 SQL 问题
proc sql;
create table two as
select *, case when min(var3)=max(var3) then ' ' else max(var3) end as id3,
case when min(var2)=max(var2) then ' ' else max(var2) end as id2,
case when min(var1)=max(var1) then '' else max(var1) end as id1
from test
group by id
having var3=id3 or(id3=' 'and var2=id2) or (id3=''and id2=''and var1=id1);
quit;
l******9
发帖数: 579
46
【 以下文字转载自 Database 讨论区 】
发信人: light009 (light009), 信区: Database
标 题: SQL combine two tables into one table and add a new column
发信站: BBS 未名空间站 (Thu May 8 14:54:50 2014, 美东)
I need to add a column with an int value to the result from a subquery on
SQL.
It is Netezza SQL.
SELECT *
FROM
(
SELECT *
FROM table1
JOIN
table2
ON table1.id1 = table2.id1
GROUP BY table1.id2, table2.id3
) AS tt_a # here, I need to add a new column to tt, c... 阅读全帖
w*******y
发帖数: 60932
47
Just got this email from wyndham-vacations concerning last minute vacations.
Prices seem to start at $ 375 per unit / per week. Available for 2 to 8
people. Different dates, e.g. November, December, January.
Locations and times vary. They offer US locations as well as some
international locations.
Seems like a great deal - especially if you are travelling with 6 to 8
people and share one of the units for a total of less than $400 a week !
Link:
http://www.wyndham-vacations.com/main.taf?p=4,6&id1... 阅读全帖
c**z
发帖数: 669
48
complier能过,但是run不过,请指教
class book
{
public:
book(long id1,string detail1 )
{ id=id1; detail=detail1;
}
book()
{
}
void addbook(long id2, string detail2)
{ book b(id2,detail2);
books.push_back(b);
}
private:
long id;
string detail;
static vector books;
};
void main()
{
book b1;
b1.addbook(1,"a");
b1.addbook(2,"b");
}
b**********e
发帖数: 100
49
来自主题: JobHunting版 - 报面经+offer
找工作结束,onsite面过G,F,M,最后拿到G的offer,碰上的题大多数都是老题,而
且不难。我碰上的有点难的,而且没见过的题,我在最后列出来。
我总体的感觉是准备题只是一个基础,大家还应该注意沟通和表达能力。面试官如果问
我们会的题,争取做到communication方面不会扣分。比如说,面试官给你一个题,多
数情况他们会故意把题说的比较含糊,然后让你主动来问问题clarify,而我们有的时
候会主观的加一些假设,来向我们会的问题上靠。
等把面试官的题意弄清楚之后,我们一般会选一种数据结构来解这个问题,但是面试官
如果问你为什么选这个数据结构,我们应该解释清楚,或者面试官会暗示你这个数据结
构他认为不对,我们应该能够随机应变,说出他想要的。
数据结构和算法确定了以后,写code应该是bug free的,有bug会make a big
difference
写完code,最好在板上演示一个简单的例子,这样也能帮助我们找到bug。
最后一般都会问时间空间复杂度,我觉得最好先跟面试观clarify一下N代表什么。我是
吃过这方面亏的,我说O(N),面试官说N square,结果后来发... 阅读全帖
c*****r
发帖数: 2866
1 2 3 4 下页 末页 (共4页)