Click here to Skip to main content
15,911,896 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have a Table. now i want generate data from 2nd column in a table. How to write query in sql?
i don't want from 1st column.i want from 2nd column
Posted
Comments
ssd_coolguy 23-Aug-12 4:55am    
can you elaborate more..
sai sagar 23-Aug-12 5:00am    
i have a table contains 1000 records now i want Generate data from 2nd record to 1000, except 1st record
ssd_coolguy 23-Aug-12 5:05am    
if i understands you correctly then.
you have table contains
1
2
3
4
.
.
n
records and you need only
2
3
4
.
.
n
not 1st record.. am i right?
sai sagar 23-Aug-12 5:10am    
ya exactly like this

Select 2nd_Column_namme from table Name.
 
Share this answer
 
Comments
sai sagar 23-Aug-12 5:05am    
in my table contain 1000 records. generate Data from 2nd record to 1000 record except 1st record
Kamalkant(kk) 23-Aug-12 6:50am    
select * from table where id !=(select top 1 id from table)
SQL
SELECT * FROM
(
SELECT *,ROW_NUMBER() OVER(ORDER BY ID) AS 'RowRank' FROM TABLE1
) AS TABLE1 WHERE RowRank>1


Try this statement & fun coding dear...
 
Share this answer
 
if your table contains id as a primary key then..
SQL
select * from table1 where id!=(select top 1 id from table1)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900