Thursday, October 13, 2011

SQL: duplicate a row in a access table


Shafeen


Q1: how can you duplicate a row in a access table, what is the sql command for that?



INSERT tablename (SECTION_NAME, SECTION_ID) SELECT SECTION_NAME, SECTION_ID FROM tablename



Q2: see the table below:

a     b     c     d

1    2      3      4

2    2      10   9

3    3     15    12

4    2     7      8

5    3     6      9

How can I get the very last number in column b?

i.e. I want to get the very last row for 2 or 3 in column b. How can I do that.



select top 2 * from [table1]

or selece last 2 * from [table1]

1 comment:

Anonymous said...

http://google.com/