![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi All, I need help in writing a query to get the first row of the following query result. 1> select db_name, smiNumber,xyz = datediff(day,db_start_date, getdate()), pubname from publication p, db_pub_table dp, db_table d 2> where p.Id = dp.pub_id 3> and dp.db_id = d.db_id 4> and journalcode = "NYT" 5> go db_name smiNumber xyz pubname ---------- --------- ----------- ------------------------------------------ ---------------------------------------------------------- Y041 30ba 157 The New York Times 0DIM 30ba 8709 The New York Times 0FEE 30ba 8343 The New York Times 0EVV 30ba 7978 The New York Times 0EVW 30ba 7613 The New York Times (5 rows affected) |
#3
| |||
| |||
|
| ars wrote: Hi All, I need help in writing a query to get the first row of the following query result. 1> select db_name, smiNumber,xyz = datediff(day,db_start_date, getdate()), pubname from publication p, db_pub_table dp, db_table d 2> where p.Id = dp.pub_id 3> and dp.db_id = d.db_id 4> and journalcode = "NYT" 5> go db_name smiNumber xyz pubname ---------- --------- ----------- ---------------------------------------- -- ---------------------------------------------------------- Y041 30ba 157 The New York Times 0DIM 30ba 8709 The New York Times 0FEE 30ba 8343 The New York Times 0EVV 30ba 7978 The New York Times 0EVW 30ba 7613 The New York Times (5 rows affected) How about: select db_name, smiNumber,xyz = datediff(day,db_start_date, getdate()), pubname from publication p, db_pub_table dp, db_table d where p.Id = dp.pub_id and dp.db_id = d.db_id and journalcode = "NYT" and db_name = "Y041" and smiNumber = "30ba" and pubname = "The New York Times" hahahaha, I crack myself up!!! Ok, now I feel better... If you can't use 'set rowcount', can you guarantee that these rows are all unique? It doesn't seem so. Is there any real order in these rows? What is special about that first row? Joe Weinstein at BEA |
![]() |
| Thread Tools | |
| Display Modes | |
| |