由买买提看人间百态

topics

全部话题 - 话题: col4
1 (共1页)
l******9
发帖数: 579
1
I am sorting two tables on SQL.
The two tables have the same column names and types and rows numbers.
I used order by to do sorting but the two tables are different in order.
Example,
col1 INT
col2 INT
col3 INT
col4 DOUBLE PRECISION
SELECT *
FROM table1 AS t1
ORDER BY t1.col1 , t1.col2, t1.col3, t1.col4 ASC
SELECT *
FROM table2 AS t2
ORDER BY t2.col1 , t2.col2, t2.col3, t2.col4 ASC
Table1 is :
col1 col2 col3 col4
80 790 3498 18654.064361
81 589 3182 2138518.05404
80 ... 阅读全帖
l******9
发帖数: 579
2
【 以下文字转载自 Database 讨论区 】
发信人: light009 (light009), 信区: Database
标 题: sort two same tables SQL but different results
发信站: BBS 未名空间站 (Fri May 9 09:57:41 2014, 美东)
I am sorting two tables on SQL.
The two tables have the same column names and types and rows numbers.
I used order by to do sorting but the two tables are different in order.
Example,
SELECT *
FROM table1 AS t1
ORDER BY t1.col1 , t1.col2, t1.col3, t1.col4 ASC
SELECT *
FROM table2 AS t2
ORDER BY t2.col1 , t2.col2, t2.col3, t2.col4 ASC
T... 阅读全帖
l******9
发帖数: 579
3
【 以下文字转载自 Database 讨论区 】
发信人: light009 (light009), 信区: Database
标 题: sort two same tables SQL but different results
发信站: BBS 未名空间站 (Fri May 9 09:57:41 2014, 美东)
I am sorting two tables on SQL.
The two tables have the same column names and types and rows numbers.
I used order by to do sorting but the two tables are different in order.
Example,
SELECT *
FROM table1 AS t1
ORDER BY t1.col1 , t1.col2, t1.col3, t1.col4 ASC
SELECT *
FROM table2 AS t2
ORDER BY t2.col1 , t2.col2, t2.col3, t2.col4 ASC
T... 阅读全帖
l******9
发帖数: 579
4
【 以下文字转载自 Database 讨论区 】
发信人: light009 (light009), 信区: Database
标 题: sort two same tables SQL but different results
发信站: BBS 未名空间站 (Fri May 9 09:57:41 2014, 美东)
I am sorting two tables on SQL.
The two tables have the same column names and types and rows numbers.
I used order by to do sorting but the two tables are different in order.
Example,
SELECT *
FROM table1 AS t1
ORDER BY t1.col1 , t1.col2, t1.col3, t1.col4 ASC
SELECT *
FROM table2 AS t2
ORDER BY t2.col1 , t2.col2, t2.col3, t2.col4 ASC
T... 阅读全帖
l******9
发帖数: 579
5
【 以下文字转载自 Database 讨论区 】
发信人: light009 (light009), 信区: Database
标 题: SQL copy a table into a new table and add a new column
发信站: BBS 未名空间站 (Fri May 23 12:05:22 2014, 美东)
need to copy a table into a new table on SQL server 2008. Also, add a new
column into the new table.
The values of the new column depends on the compare result between the new
table and another table.
Example,
Table1:
col1 col2 col3
abc 346 6546
hth 549 974
Table1_new:
col1 col2 col3 c... 阅读全帖
l******9
发帖数: 579
6
need to copy a table into a new table on SQL server 2008. Also, add a new
column into the new table.
The values of the new column depends on the compare result between the new
table and another table.
Example,
Table1:
col1 col2 col3
abc 346 6546
hth 549 974
Table1_new:
col1 col2 col3 col4
abc 346 6546 1
hth 549 974 0
Table2:
col1
abc
sfsdf
If Table2's col1 appear in Table1 col1, mark col4 as 1 in Table1_new, el... 阅读全帖
l******9
发帖数: 579
7
【 以下文字转载自 Database 讨论区 】
发信人: light009 (light009), 信区: Database
标 题: SQL copy a table into a new table and add a new column
发信站: BBS 未名空间站 (Fri May 23 12:05:22 2014, 美东)
need to copy a table into a new table on SQL server 2008. Also, add a new
column into the new table.
The values of the new column depends on the compare result between the new
table and another table.
Example,
Table1:
col1 col2 col3
abc 346 6546
hth 549 974
Table1_new:
col1 col2 col3 c... 阅读全帖
l******9
发帖数: 579
8
【 以下文字转载自 Database 讨论区 】
发信人: light009 (light009), 信区: Database
标 题: SQL copy a table into a new table and add a new column
发信站: BBS 未名空间站 (Fri May 23 12:05:22 2014, 美东)
need to copy a table into a new table on SQL server 2008. Also, add a new
column into the new table.
The values of the new column depends on the compare result between the new
table and another table.
Example,
Table1:
col1 col2 col3
abc 346 6546
hth 549 974
Table1_new:
col1 col2 col3 c... 阅读全帖
i*****y
发帖数: 188
9
来自主题: Statistics版 - A R question
Hi everyone,
I have a question that needs help.
I have a data frame, let's say, 4 columns;
Now i want to calculate the ratio of col1/col4, col2/col4, col3/col4;
Sure we could do it manually. But I was just wondering if there is any
function available for doing this?
Thanks a lot
B*****g
发帖数: 34098
10
来自主题: Database版 - 菜鸟问题,急
CREATE TABLE NewTable AS
SELECT *
FROM ( SELECT COL1,COL2 FROM Table1
UNION ALL
SELECT COL3,COL4 FROM Table2)
or
INSERT INTO NewTable
SELECT *
INTO NewTable
FROM ( SELECT COL1,COL2 FROM Table1
UNION ALL
SELECT COL3,COL4 FROM Table2)
M***7
发帖数: 2420
11
来自主题: Database版 - 菜鸟问题,急
guys, thanks a lot .
Finally I used the following query
=====================
INSERT INTO NewTalbe
SELECT col1, col2 FROM TABLE1
UNION ALL
SELECT col3 col4 FROM TABLE2
======================
It woks.
If I use
=================
CREATE TABLE newtable AS
SELECT *
FROM (SELECT col1, col2 FROM TABLE1
UNION ALL
SELECT col3 col4 FROM TABLE2)
===================
It still did not work.
Could anyone explain it a little bit detail for me? I am really a rookie in
SQL.
Thanks.
T****U
发帖数: 3344
12
来自主题: Database版 - 请教几个面试题
My answer to Q3
select * from
((select col1, col2, col3, col4, col5 from sevencol)
minus fivecol)
Union
(fivecol minus
(select col1, col2, col3, col4, col5 from sevencol))

query
c*****d
发帖数: 6045
13
来自主题: Database版 - 请问sql 有条件性的select columns
首先,这个表这么设计不好
不过估计你也不能改表的设计
类似是同一时间N个传感器传回过来的数据
其次,cursor不是干这个用的
cursor是move from one row to the other
这个就是一个简单的nested if
if ( col2 is not null )
return col2
elsif ( col3 is not null )
return col3
elsif ( col4 is not null )
return col4
...
o****o
发帖数: 8077
14
来自主题: Statistics版 - 请问如果用SAS 解决这个问题
data _xxx;
input var1 var2 var3 var4;
cards;
2 4 6 7
4 9 7 6
5 2 1 1
7 3 7 3
;
run;
proc transpose data=_xxx out=_xxx2;
run;
proc means data=_xxx2 noprint;
var col1-col4;
output out=_xxx3(keep=v1-v4)
maxid(col1(_name_)
col2(_name_)
col3(_name_)
col4(_NAME_))= v1-v4/autoname;
run;
proc transpose data=_xxx3 out=_xxx3t;
var v1-v4;
run;
d... 阅读全帖
e****e
发帖数: 2010
15
方法比较傻瓜,需要把Code编辑好,安装浏览器Extension。 职业高中,技校的,文科
女生可以试试,大牛和名校毕业的就算了。觉得有用就给些包子,饿S了。
1) Download and Install iMacros IE extension
http://download.cnet.com/iMacros-for-Internet-Explorer/3000-125
10586882.html
2) Create your code CVS txt file, PlumTarget.txt, Looks like:
Email,CardN,AccessN,RedeemN
xxx@xxx,xxxx,xxxx,xxxxxx
xxx@xxx,xxxx,xxxx,xxxxxx
…...................
Note: 四列文件,只有逗号,没有任何空格。可以用Excel, 存为cvs text file.
3) Edit and Play iMacros File
Edit #Current.iim file as following, save as any file n... 阅读全帖
f*******g
发帖数: 245
16
几十年,就tmd 985时那么一次。
北医985,211都没得到过北京市的拨款。运营经费是中央政府出的。
引用北医校史: 1952年,全国高等学校院系调整,北京大学医学院脱离北京大学,独
立建院并更名为北京医学院,院长为胡传揆教授。直属中央卫生部领导,办学经费由中
央财政部转中央卫生部拨付。http://www.bjmu.edu.cn/col/col4/index.html
就是那些985大学,由北京市政府一次性给3亿, 也不是理由牺牲全国其他省老百姓的
利益,为北京市独特服务的理由。
各种各样不公平的民怨,像火山似的堆积,迟早会淹没/摧毁一切。
d**********o
发帖数: 1321
17
来自主题: WebRadio版 - 潜水员冒泡兼征版友意见
RTOS作业:2514
The purpose of this assignment is to give you more experience using the AVR
ports, and to add some I/O devices that might become useful later for our
RTOS.
You are to use one of the provided keypads to implement a “digital lock.”
Your program should allow the user to enter a four digit code from the
keypad, and if the code that is input matches the one included in your
program, the “lock” should open. In this case, the lock opening will be
represented by the lighting of an LED.
As th... 阅读全帖
d**********o
发帖数: 1321
18
来自主题: WebRadio版 - 潜水员冒泡兼征版友意见
RTOS作业:2514
The purpose of this assignment is to give you more experience using the AVR
ports, and to add some I/O devices that might become useful later for our
RTOS.
You are to use one of the provided keypads to implement a “digital lock.”
Your program should allow the user to enter a four digit code from the
keypad, and if the code that is input matches the one included in your
program, the “lock” should open. In this case, the lock opening will be
represented by the lighting of an LED.
As th... 阅读全帖
M***7
发帖数: 2420
19
来自主题: Database版 - 菜鸟问题,急
请问下面这个QUERY为什么不WORK
SELECT *
INTO NewTable
FROM ( SELECT COL1,COL2 FROM Table1
UNION ALL
SELECT COL3,COL4 FROM Table2)
括号里的QUERY单独可以work。这里我如果想加order by 的话可以吗?
谢谢
b*****e
发帖数: 364
20
来自主题: Database版 - 菜鸟问题,急
Try this one. Just add a alias name.
SELECT *
INTO NewTable
FROM ( SELECT COL1,COL2 FROM Table1
UNION ALL
SELECT COL3,COL4 FROM Table2) a
h******l
发帖数: 422
21
来自主题: Database版 - 问个sql/ ssis的问题 谢谢!
你的意思是:
假设 tbl1:
col1 col2 col3 col4 col5 col6
m*****i
发帖数: 2325
22
来自主题: Database版 - 一个oracle performance 的问题。
oracle 9i。
我有一个大table 叫 TA 吧, 7,8 个million record 吧。
table 有primary key。 由好几个column 组成。就叫 (col1,col2,col3,col4,
col5,col6) 吧。
当我运行如下query 时,非常慢,要十几分钟。
1) select count(*) from TA a where a.col1=601
但当我运行下面的query 是 却非常快,十几秒就行了。
2) select count(*) from TA a where a.col1=601 and a.col2 like 'ABC%'
为什么呢? 有什么办法可以让 1) 也运行的快点吗?
l******9
发帖数: 579
23
the types:
col1 INT
col2 INT
col3 INT
col4 DOUBLE PRECISION
thanks !
k********e
发帖数: 702
24
SELECT *
FROM table2 t2
ORDER BY t2.col1 asc, t2.col2 asc, t2.col3 asc, t2.col4 asc, t2.col5 asc
a**d
发帖数: 4285
25
执行了一下,可行:
select t1.col1, t1.col2, t1.col3,
col4= case when t2.col1 is not null then 1
else 0
end
into table_new
from table1 t1 left join table2 t2 on t1.col1=t2.col1
h******y
发帖数: 25
26
来自主题: Database版 - 请问sql 有条件性的select columns
具体例子如下:
select * from table -- gives the following output
server col2 col3 col4 col5 col6 col7 col8 col9 col10
1 1234 null null 678 987 890 null 567 null
1 4565 null null 234 67 56 null 345 null
2 null null 578 567 234 null 73 18 null
2 null null 626 289 395 null 84 399 null
3 567 null 845 null 987 674 null null... 阅读全帖
i*******d
发帖数: 81
27
来自主题: Database版 - 请问sql 有条件性的select columns
why data appears in pairs? is it always true?
What is the desired output if you have:
server col2 col3 col4 col5 col6 col7 col8 col9 col10
1 1234 null null 678 987 890 null 567 null
1 null null null 234 67 56 null 345 null

null
null
null
648
921
h**u
发帖数: 1512
28
来自主题: Database版 - 如何除去duplicate rows?
我有下列一组数据:
COL1 COL2 COL3 COL4
1 A1 A2 A3 NULL
2 A1 A2 A3 A4
3 B1 B2 B3 NULL
4 B1 B2 B3 B4
5 C1 C2 C3 NULL
6 C1 C2 C3 C4
我想如果count(COL1)>1 就只显示row2,4,6,除去null的1,3,5。该如何实现呢
?多谢了。
g*********h
发帖数: 21
29
but seems tabular also not work
\begin{tabular}{|c|}
%
after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
\begin{figure}

% Requires \usepackage{graphicx}

\includegraphics[width=3in]{./Chapter-3/Figures/fusion_psnr.eps}

\end{figure}
\end{tabular}
x*******u
发帖数: 500
30
来自主题: Statistics版 - 请教SAS 问题
只想出这个笨办法, 有没有更简单的
data a;
input x y z m n;
cards;
1 2 3 . 4
2 3 4 5 6
1 . 3 5 6
1 3 4 . .
;
run;
proc contents data=a out=out(keep=name); run;
proc sql noprint;
select name into: name separated by ' ' from out;
run;
proc transpose data=a out=b;
run;
data c; set b;
missnum=nmiss(of col1-col4);
run;
data d(where=(missnum=0))
e(where=(missnum>0));
set c;
run;
h********o
发帖数: 103
31
来自主题: Statistics版 - 请教大家 这个SAS小程序怎么编
DATA ONE;
INPUT VAR $ @@;
CARDS;
A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14
;
DATA ONE;
SET ONE;
RETAIN ID ;
IF MOD(_N_, 5) = 1 THEN ID + 1;
RUN;
PROC TRANSPOSE DATA = ONE OUT = TWO (DROP = _NAME_ ID
RENAME = (COL1 = VAR1
COL2 = VAR2
COL3 = VAR3
COL4 = VAR4
C... 阅读全帖
l****u
发帖数: 529
32
select table1.*, case when table1.col1=table2.col1 then 1 else 0 end as col4
from table1 left join table2 on table1.col1=table2.col1;
1 (共1页)