由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - small problem about DAO
相关主题
请问个join的问题有包子!sql procedure 来rank不同table里面的数据
mysql 问题 (转载)MSSQL how to create 10 tables with the same structure but different names
请问这个query怎么做一个SQL写法性能的请教
how to write this query最近写了不少SQL script,请大牛评价下属于什么水平
请问这样的表该怎么建?SQL combine two tables into one table and add a new column
Access 里面两个 column不一样的table 能combine 到一起吗?SQL add some columns into a table from another table (转载
在没有Key的情况下,怎么update一个table的内容到另一个table?How to find intersection of two tables
Common Table Expression 问题求教...初级问题
相关话题的讨论汇总
话题: state话题: table话题: abv话题: states话题: table4
进入Database版参与讨论
1 (共1页)
l******n
发帖数: 9344
1
a table(15k records) with codes to indicate state. now I have to compare it
with another table, so need to convert all state codes to state
abbreviations.
any quick way to do it? thanks
x****y
发帖数: 252
2
any quick way to do it?
l******n
发帖数: 9344
3
My case is a little complicated
because in some data, the state code is abbreviation. So it is mixed up,like
08 CA 21
99 TX LA NY 01
BTW, another question is if one column is Yes/No, how to count the number of
Yes?
Thanks

【在 x****y 的大作中提到】
: any quick way to do it?
B*****g
发帖数: 34098
4
不明白。

like
of

【在 l******n 的大作中提到】
: My case is a little complicated
: because in some data, the state code is abbreviation. So it is mixed up,like
: 08 CA 21
: 99 TX LA NY 01
: BTW, another question is if one column is Yes/No, how to count the number of
: Yes?
: Thanks

l******n
发帖数: 9344
5
OK, Beijing
This is my problem.
Table 1 has Year, STATES, Event. STATES may contain many states and use abv,
event contains many events
Table 2 has Year, STATE1, STATE2,..., STATE7, Event1,...,Event10. But STATE1
is using abv, but STATE2 use code, which has to use table 3 to know the abv
. Each state1(to 7) only contains 1 state or nothing.
Table 3 is Statecode, State.
now I want to know how the relationship between table 1 and table 3.
I want to know in year 2008 and 2007, in each state how man

【在 B*****g 的大作中提到】
: 不明白。
:
: like
: of

n********6
发帖数: 1511
6
Is it for production? Or just for your research?
If it is just for your research, change the full state name to abv and put
them in a temp table might be a way with clear logic for later process.

abv,
STATE1
abv

【在 l******n 的大作中提到】
: OK, Beijing
: This is my problem.
: Table 1 has Year, STATES, Event. STATES may contain many states and use abv,
: event contains many events
: Table 2 has Year, STATE1, STATE2,..., STATE7, Event1,...,Event10. But STATE1
: is using abv, but STATE2 use code, which has to use table 3 to know the abv
: . Each state1(to 7) only contains 1 state or nothing.
: Table 3 is Statecode, State.
: now I want to know how the relationship between table 1 and table 3.
: I want to know in year 2008 and 2007, in each state how man

B*****g
发帖数: 34098
7
好像有点复杂。
state3-7是word,还是code?
你用那个DB? version?

abv,
STATE1
abv
are

【在 l******n 的大作中提到】
: OK, Beijing
: This is my problem.
: Table 1 has Year, STATES, Event. STATES may contain many states and use abv,
: event contains many events
: Table 2 has Year, STATE1, STATE2,..., STATE7, Event1,...,Event10. But STATE1
: is using abv, but STATE2 use code, which has to use table 3 to know the abv
: . Each state1(to 7) only contains 1 state or nothing.
: Table 3 is Statecode, State.
: now I want to know how the relationship between table 1 and table 3.
: I want to know in year 2008 and 2007, in each state how man

l******n
发帖数: 9344
8
15k data!

【在 n********6 的大作中提到】
: Is it for production? Or just for your research?
: If it is just for your research, change the full state name to abv and put
: them in a temp table might be a way with clear logic for later process.
:
: abv,
: STATE1
: abv

l******n
发帖数: 9344
9
state 1- 7 all use text, but some of them are abv, some are codes. And the
positions are not fixed.
I am using access and it is the only one I can use.

【在 B*****g 的大作中提到】
: 好像有点复杂。
: state3-7是word,还是code?
: 你用那个DB? version?
:
: abv,
: STATE1
: abv
: are

B*****g
发帖数: 34098
10
cft。
这里都是大牛,每天搞得一个table数据都是几十至上百个Millions。
Access可能难搞一些,我先看看。

put

【在 l******n 的大作中提到】
: 15k data!
B*****g
发帖数: 34098
11
想了想,还是再建个table吧。
Table4
Table4 has ID, Year, STATES, Event, STATES_MIX
(ID is autonumber)
INSERT INTO Table4 (Year, Event, STATES_MIX)
SELECT Year, Event(1-10), STATE(1-7)
WHERE Event(1-10) is not null
AND STATE(1-7) is not null
***70个insert
Option: delete the dup records in table4
Table4 create index on state_mix
UPDATE table4 t4 inner join table3 t3 on t4.state_mix = t3.Statecode set t4.
state = t3.state.
UPDATE table4 t4 inner join table3 t3 on t4.state_mix = t3.State set t4.stat
e = t3.s

【在 l******n 的大作中提到】
: state 1- 7 all use text, but some of them are abv, some are codes. And the
: positions are not fixed.
: I am using access and it is the only one I can use.

l******n
发帖数: 9344
12
就是就是,呼唤大牛现身

【在 B*****g 的大作中提到】
: cft。
: 这里都是大牛,每天搞得一个table数据都是几十至上百个Millions。
: Access可能难搞一些,我先看看。
:
: put

j*****n
发帖数: 1781
13
不好整,先解决 table1 再说其他:
In States column of table1, the states are delimited by space, so you may
have to come out a string process to read characters one by one, from begin
to the end. put each state as a element of an array.
1 (共1页)
进入Database版参与讨论
相关主题
求教...初级问题请问这样的表该怎么建?
how to see all the tables in SQL*PLUS?Access 里面两个 column不一样的table 能combine 到一起吗?
foreign key reference to two tables? how to do it?在没有Key的情况下,怎么update一个table的内容到另一个table?
how to list all tables in my account?Common Table Expression 问题
请问个join的问题有包子!sql procedure 来rank不同table里面的数据
mysql 问题 (转载)MSSQL how to create 10 tables with the same structure but different names
请问这个query怎么做一个SQL写法性能的请教
how to write this query最近写了不少SQL script,请大牛评价下属于什么水平
相关话题的讨论汇总
话题: state话题: table话题: abv话题: states话题: table4