我想为select语句中的每个重复行分配一个唯一的数字。
表
名称|位置
马克沃尔1
马克沃尔1
MArtha 1
玛莎1
我想要这个
1 Mark Wl 1 2 Martha 1
答案 0 :(得分:1)
您可以根据需要使用尽可能少的行。如果要使用所有行,请将它们全部列出。
SELECT Row1, Row2, Row3,
ROW_NUMBER() OVER (
PARTITION BY Row1, Row2, Row3,
ORDER BY Row1
)
FROM Table
答案 1 :(得分:0)
最好的解决方案是每个记录都有一个唯一的ID,然后你选择显示它(这将来自第一个找到的记录)......
ggplotcmd <- ggplot(data_geno, aes(x=x_pos, y=-log10(p), color=chr)) +
scale_x_continuous(breaks = last_bp_vec,minor_breaks=NULL,labels=seq(26)) +
geom_hline(aes(yintercept=-log10(5e-08))) +
geom_point(shape=20, size = 1) +
geom_point(data=data_imp,color="black",shape=4) +
xlab("") +
theme(axis.text.x = element_text(hjust=0)) +
scale_color_manual(values=c("deeppink2", "orange", "green2", "blue", "yellow",
"purple", "magenta", "darkgreen", "gold", "firebrick", "yellowgreen", "red",
"black", "turquoise3", "tomato", "darkblue", "chocolate", "violet", "slategray4",
"OrangeRed", "darkblue", "deeppink", "aquamarine3", "steelblue1", "mediumorchid",
"yellowgreen")) +
ggtitle(man_title)