March 3, 2010 at 8:24 pm
I am trying to get the top1 column from a table in a select statement which contains multiple columns from multiple columns,
Basically , Below is how my query looks like
Select col1,col2,col3,table4.col4,col5
from table1 innerjoin table2 left join table3,left outer join table4 .
where..............................
here in table 4 the data is not updated but a new record is inserted when their is a update. I have to see that table4.col4 is compared with input and table4.col4 is the top1 row when i am checking dateentered desc.
All this needs to be in sql query as prev developer has written this page in HTML
So i am selecting only one column which shd be the top1 of that table and none others in that select statement
March 4, 2010 at 11:53 am
Perhaps I'm asking too much but could you provide the DDL, the DM to insert the Data and your Statement so that you may be better assisted?
Thanks,
WC
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
March 4, 2010 at 12:38 pm
In addition to the data WC asked for, you should provide the column we need to order the values. Otherwise the TOP statement won't make that much sense...
March 5, 2010 at 8:19 am
Hi guys,
I apologise for posting incomplete question, i found out the solution for it.will post here asap
March 5, 2010 at 8:36 am
Thank you Lutz, please accept my apology for not asking for complete information...
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
March 5, 2010 at 10:17 am
Welsh Corgi (3/5/2010)
Thank you Lutz, please accept my apology for not asking for complete information...
No reason to apologize. That's what a forum is all about: to have more than just one person to look at a problem.
And if someone did overlook a required information (or assumed that it would obviously be needed and therefore didn't ask for it specifically), then there will be others to expand the question. There's nothing wrong with it (especially nothing that would require to delete a post 😉 ).
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply