Query Within A Query?

I have a table that looks kinda like this

Tag         Info              SignOutDate
1             Hi                   09/03/2005
1             Hi                   09/02/2005
1             Hi                   08/19/2005
2             Hi                   09/03/2005
12           Hi                   09/03/2005
12           Hi                   08/12/2005
18           Hi                   09/03/2005

Now I want to select each TAG # for the latest SignOutDate.  I then have to link it to other tables which I can prolly figure out.  But is this all possible in one statement?



0
boypdp
10/4/2005 2:21:35 PM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

1 Replies
712 Views

Similar Articles

[PageSpeed] 36

You can do it as a subquery:

Select Tag
From Table
Where SignOutDate = (Select MAX(SignOutDate) From Table)

Marcie
http://www.datagridgirl.com
NEW! http://www.gridviewgirl.com
0
datagridgirl
10/4/2005 2:51:25 PM
Reply:

Similar Artilces:

C# Ado.net Sql query parameter query
Hi All, I'm trying to pass in a parameter value from an array in a loop that is used in a sql query and the results are populated to an xml file. The trouble is that I'm only getting the colums values in the outputted xml file. So I feel that the paramter is not being read. So can anyone help as I'm really stuck on this one. The code is as follows : public void DisplayUserInfo() { ArrayList UserIdArrayList = IdentifyUserID(); foreach(string ShowUserIDString in UserIdArrayList) { try { SqlConnection SqlConn = new SqlConnection(DBConnString)...

Query about Queries
Hello all, As a relatively new user to Sybase I am hoping someone can point me in the right direction. We are getting ready to go live with our database and I am wondering what types of queries I should be running for system performance purposes. If anyone has any suggestions they would be more than appreciated. Thanks in advance, Jerry ...

How to query a query...
I'm working on converting an Access DB that I created into an ASP.NET application (and attempting to learn ASP at the same time...). One of my queries was very complex and required running a different query first, and then working off of that one. Any suggestions on the best way to do this in ASP? The following is a sample of code I'm using so you can see the type of data-binding I'm using. Thanks for the help! myConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; " +"Data Source=" + Server.MapPath("/EquipmentCheckout.mdb")) strS...

Query a Query
I have a result set in a query. Is it possible to query this query? (no specific SQL dialect, can it be done generically?) Petros -- PETROS GAVRIELIDES wrote: > I have a result set in a query. > Is it possible to query this query? > > (no specific SQL dialect, can it be done generically?) There is a generic answer to your question: Yes, there is a construct called a sub-query that allows you, in 1 SQL statement, to query from a query. But, generically speaking, not all DB engines support this construct. For instance, Firebird only added it just over a y...

Can sql queries be nested in sql queries?
I am having problems with a template that uses the information from one sql query to generate a query on another table. Let me be more specific. The template in question receives a category ID value from a web page that provides a menu of several categories to choose from. Each Category ID represents several Items or products to choose from. When the template receives the category ID, the first thing it does is run a query on my item_category table (this table lists all of the items and associates them with the appropriate category). This query returns several itemIDs that are all...

How to Query A Query
I have been trying to build a crosstab report that reports everydate within a selected range across the top and specific row information. 7/1 7/2 7/3 . . . Name Detail1 Detail2 Detail3 Name Detail1 What I get as output is only the dates that contain information in the rows. I can get the information I need by using a query within a query (nested). Can a nested query be done in Informaker 5? What about version 6 or 7? Thanks for your help Convert your SQL to syntax, and you can write anything you want. So if your DB support...

performing a query within a query
Hey folks, Was wondering (yet again) if there is an easy way of performing a query on another query. For example: I am displaying areas from one table and towns within that area from another table and the output should look like this: Area 1 ---Town A ---Town B I was wondering what is the best way to do this. Thanks for any help. Select AreaInfo,TownInfo FROM Area INNER JOIN town ON Area.AreaID=town.AreaID ORDER BY AreaInfo,TownInfo Then you would need to do the formatting in the Web page.Starting with ASP.NET 2.0? Look at:Programming Microsoft Web Forms My Blo...

querying within a loop of a query
Hey all,I'm a total new to ASP.NET, I've been a long time ColdFusion and PHP developer.  I'm looking to convert my site from CF to .NET and while reading info on the data display methods I'm having a hard time finding the solutions I'm looking for.  First off, here's the site: www.walkenclips.comEssentially I query the db to get a list of movies.  I then need to loop through each movie and query the db to get a list of all sound clips associated with that movie.  The sudo code would be:select movies (id, title, etc. etc.)start movie query loop    output id,...

querying within a loop of a query
Hey all,I'm a total new to ASP.NET, I've been a long time ColdFusion and PHP developer.  I'm looking to convert my site from CF to .NET and while reading info on the data display methods I'm having a hard time finding the solutions I'm looking for.  First off, here's the site: www.walkenclips.comEssentially I query the db to get a list of movies.  I then need to loop through each movie and query the db to get a list of all sound clips associated with that movie.  The sudo code would be:select movies (id, title, etc. etc.)start movie query loop    out...

Sql Query is dropping characters in my query!
Hey, I'm querying a database like this:   Dim strSql As String Dim email As String  strSql = String.Format("select * from tblsales where email={0}", email)   The string 'email' is an email address, for this example, lets use 'bobmarley@yahoo.co.uk'What happens is that somewhere its cutting off my email address at the end, in some cases it takes away the full '.co.uk' and leaves you with 'bobmarley@yahoo'and in other cases takes the '.uk' away but keeps the '.co'Anyone got any ideas? The valu...

Datasource Sql query
 Hi, I am a coldfusion developer, but have now moved over to ASP.NET using VS2008 Pro, so trying to learn it quickly. My problem is that I have created a datasource with a simple query and when I run it in the query builder it works fine, however when I run it on the page I get nothing. Here is my query    <asp:SqlDataSource ID="qAllTrucks" runat="server"         ConnectionString="<%$ ConnectionStrings:ConnectionString %>"         ProviderName="<%$ Con...

Query works in query builder but not from within the code
I am a newbie and using VS2008. I need to use wildcard character but kept running into problem.FYI, the following SQL command ran fine and generated correct results when tested in the VS2008 Query Builder. However, when I called the corresponding method from within the code, the method returns an empty data table (count = 0). I suspect this could be a problem with various data types in the database table, e.g. varchar and char, but I'm not sure.------------------------SQL Command------------------------ SELECT     ID, LastName, Address, Email FROM   ...

LDAP queries linked to SQL database queries
Hi, I am wondering whether it is common practice to use the AD domain users information as a link table for user information in database queries. My first thought is that it would be too slow since it can potentially query the AD many times depending on the number of records returned. Any insight is appreciated, sivilianMy Weblogs...

sql or my sql query
hi,in my database  i have the two tables...1)programs                                2)reservedin the programs...two fields 1)program id           2)maxseats................these details wil be entered by adminin the reserved table  two fileds ..1)PRogramid        2)statusmy requirement is .. i need the available seats..meansif any body is intersted in  any program...they wil select the program...then status becomes approved(1)..then i need the o/p as ...

Web resources about - Query Within A Query? - asp.net.sql-datasource

Merry Christmas, Bro! Warm Weather Means Surf's up in NYC
Forget the Rockefeller tree or Macy's windows, warm Christmas brings surfers to NYC waters

Robert Downey Jr. Pardoned for 1990s Drug Convictions By California Governor
People Magazine Robert Downey Jr. Pardoned for 1990s Drug Convictions By California Governor People Magazine Robert Downey Jr. got a one-of-a-kind ...

Democratic Candidates Slam Planned Deportation of Undocumented Immigrants
A Washington Post report detailing planned raids to deport hundreds of families who have fled from Central America to the United States illegally ...

Bristol Palin gives birth to her second child
(Reuters) - Bristol Palin, a daughter of 2008 Republican vice presidential candidate Sarah Palin, has given birth to a second child out of wedlock. ...

A Brief Pictorial Account of What Children Got for Christmas Decades Ago
Christmas is the most anticipated festive season for children in our culture, and it is easy to find out why: presents. Finding long-desired ...

Islamic State sanctioned organ harvesting in document taken in US raid
Previously, Iraq has accused Islamic State of harvesting human organs and trafficking them for profit

Modi’s Lahore visit: 4 Indian PMs have visited Pak since Independence
Before Prime Minister Narendra Modi sprang a surprise on Friday by deciding to go to Lahore for a meeting with his Pakistani counterpart, Atal ...

Janet Jackson postpones 'Unbreakable' tour to get unspecified surgery
LOS ANGELES (AP) — Janet Jackson says she is postponing her Unbreakable tour to have an unspecified surgical procedure. The 49-year-old singer ...

8 Things I’ve Learned from Instagram Over the Last Three Years
When I got my first iPhone in 2012, the very first app I downloaded was Instagram. Instagram launched in October of 2010, and quickly grew in ...

Thom Yorke posts the Radiohead James Bond theme you never got to hear
Turns out that guy who tried to bet £15,000 that Radiohead would record the theme for Spectre was onto something. For one brief, shining moment ...

Resources last updated: 12/25/2015 5:09:22 PM