English 中文(简体)
同一栏下选定的数值
原标题:Select values from same column from same table
  • 时间:2010-12-22 22:54:45
  •  标签:
  • sql-server

页: 1 根据2008年服务器不同栏目得出两套数值。

问 题

  • 243 73
  • 244 73
  • 245 73
  • 429 192
  • 430 192
  • 431 192

How can I get them like this: (This is only for temporary table)

  • 1 243 429
  • 2 243 430
  • 3 243 431

Thanks a lot in advance. Manish


Thanks for your replies. For those who weren t clear about the question - I want the result to be like that temporary table. Yesterday I realized that, Actually its not possible to select different values from same column.... I used two temporary tables SELECT QUESTION_ID WHERE ID = 73 INTO #TEMP1 and SELECT QUESTION_ID WHERE ID = 192 INTO #TEMP2. Then I inner-joined both tables to use the data for some INSERT operation... Thank you.

问题回答

我们不能。 由于没有1,2,3个原始浏览器的数值,因此无法对数据库进行自然排序,例如,243和429。

如果你 cross一:一::

SlectT t1.qid, t2.qid from table as t1, table as t2 WHERE t1.qid=243 and t2.qid between 429 and 431;

在新的表格中加上“AI”指数,你可以创造像你描述这样的东西。





相关问题
Export tables from SQL Server to be imported to Oracle 10g

I m trying to export some tables from SQL Server 2005 and then create those tables and populate them in Oracle. I have about 10 tables, varying from 4 columns up to 25. I m not using any constraints/...

SQL server: Can NT accounts be mapped to SQL server accounts

In our database we have an SQL server account that has the correct roles to access some of the databases. We are now switching to windows authentication and I was wondering if we can create a NT user ...

SQL Server 2000, ADO 2.8, VB6

How to determine if a Transaction is active i.e. before issuing Begin Transaction I want to ensure that no previous transaction are open.. the platform is VB6, MS-SQL Server 2000 and ADO 2.8

热门标签