select with subquery in select clause - 95919

Hi I need to make a select from 2 tables whit this layout always with the
newest datetime exchange currency.
The local cuurency is Mexican Pesos

Table 1 Currencies example:
CurrencyID Key Description
1 USD USA Dollar
2 EUR European Euro
3 Yen Japan Yen


Tabla 2 is Day exchange Currency
CurrencyID Equivalent DateTime
1 12.50 2010-08-07 08:00:00
1 12.55 2010-08-07 08:10:00
1 12.49 2010-08-07 08:20:00
1 12.60 2010-08-07 08:30:00
1 12.51 2010-08-07 08:40:00
1 12.52 2010-08-07 08:50:00
1 12.48 2010-08-07 09:00:00
1 12.61 2010-08-07 09:10:00 <-- the newest xchange for USD
2 16.87 2010-08-07 08:00:00
2 16.90 2010-08-07 08:10:00
2 16.88 2010-08-07 08:20:00
2 16.85 2010-08-07 08:30:00
2 16.87 2010-08-07 08:40:00
2 16.92 2010-08-07 08:50:00
2 16.80 2010-08-07 09:00:00
2 16.95 2010-08-07 09:10:00 <-- the newest xchange for Euro
3 6.73 2010-08-07 08:00:00
3 6.70 2010-08-07 08:10:00
3 6.78 2010-08-07 08:20:00
3 6.75 2010-08-07 08:30:00
3 6.77 2010-08-07 08:40:00
3 6.72 2010-08-07 08:50:00
3 6.70 2010-08-07 09:00:00
3 6.75 2010-08-07 09:10:00 <-- the newest xchange for Euro

The select query I need is always the newest exchange currency for each
currency in table 1, something like this

CurrencyID Key Description Equivalent DateTime
1 USD USA Dollar 12.61 2010-08-07 09:10:00
2 EUR European Euro 16.95 2010-08-07 09:10:00
3 Yen Japan Yen 6.75 2010-08-07 09:10:00

How can i do the select?

Plese help me 
Jose Roberto Chavez

0
jrchaveztj
8/7/2010 5:10:37 PM
sqlserver.server 1327 articles. 0 followers. Follow

0 Replies
701 Views

Similar Articles

[PageSpeed] 57

Reply:

Similar Artilces:

compare 2 columns and select the lowest
Hi I have simple question I have 2 coumns A and B A1 is text and B1 is numbers and so on.. depending of B columns numbers , i want colums C to show alway lowest numbers on top, but also text like if A1,B1 is Mike 29 then A2,B2 is Josh 34, then column C shows Mike 29 but on top, not as a secon row.. Couldn't you just sort by column B in ascending order and leave the data right where it is? If that's not ok, how about an alternative? I'd add a new column C. Then use a formula like this in C1: =text(a1,"000")&"-"&b1 and drag down...

Update workbook each time a different worksheet is selected
I need to update a workbook each time the user goes to a new worksheet either by selecting the tab for that worksheet or by hyperlink. How can I to this without using a macro? (using macro is ok if necessary but I am trying to keep things simple) DJ "Update" means what? More details please. Gord Dibben Excel MVP On Tue, 13 Dec 2005 13:50:02 -0800, DJL <DJL@discussions.microsoft.com> wrote: >I need to update a workbook each time the user goes to a new worksheet either >by selecting the tab for that worksheet or by hyperlink. How can I to this >without us...

Automatic send account selection?
A Google Groups search didn't really turn up a useful answer for me... Can Outloook 2003 in Internet Mail mode be configured to send "from" a different account/address dependant on the destination address? Specifically, for given work-related recipients, I want it to to send "from" my work email account. Also, I'm subscribed to various mailing lists from different addresses; it would be nice if I didn't have to remember to check the send-from address when posting to a given list. --- avast! Antivirus: Outbound message clean. Virus Database (VPS): 0545-1...

Reply in Plain text adds the prefix '>' when it's not selected under preferences
I recently changed computers. I don't understand why all of my plain text msgs that I reply to include the '>' character in my signature, but no where else in the body of the e-mail. When I reply in RTF, everything is peachy. Under Tools/Options/Preferences/E-ail Options, the option to select what character to prefix msgs is grayed out, so I can't even select it. This is really annoying me.... C ...

How do I get a combo box to list my selections?
I am having a hard time with the combo box. I can't get the values that I want into my combo box. I have some pre- detirmined values in cells AA1 - AA5. Please help!! Hi! I'll assume you are using a Control Toolbox combobox. Put your combo entries in an array: for simplicity, start with single column. Open the combo Properties and put the range address of th entries into ListFillRange. Wider arrays can be used in comboboxes with corresponding numbers o columns. You might also want to use the LinkedCell to extract the ordinal of th selected item in the combo. Al -- Message poste...

Best way of copy range of cells without select
Hi, Why doesn't this work? "Method 'range' in object sheet failed" . I try to get rid of the copy paste select activat - operations.... Blad105.Range("B6:B25,B29:B44,B52:B56") = Blad104.Range("B6:B25,B29:B44,B52:B56") /Thanks to any help I answer myself: Has to be a ".value" after the specified range - othervice it try to copy the range, and it can't define the same worksheet name on two sheets... /"" The value is needed baecause "Imbecill" <Imbecill@roll.se> skrev i meddelandet news:Kj_oc.59034$mU6....

Select and hide between two rows
I have a long text file from which I want to extract blocks of data. As a text import all the text starts in Column A. There are about 1000 lines in each file. I want to: 1) Search for a word "apple" within each string/row then 2) Search for another word "bacon" in another string/row then ... 3) Select and hide the rows from row "apple" to row "bacon" 4) Repeat for the next occurance "apple" to "bacon". There are 29 occurances in each file. Once I am sure that I have the correct selection I would then delete the hidden rows. Any...

Change category axes from drop down selection
Can I change the category axes for a chart linked off of what is chosen in the drop down? I have a list of region-area-individual stores, and I want to chart the individual stores when I chose an area. all of the area's when I choose a region, etc. Is there a way to autopopulate the chart axes to do that simply by selecting a drop down reference? ...

Combobox value populate cell selection
I am looking for button code to have a selected cell range merged and populated with value chosen from combobox. This value is centered in the merged cell selection. The cells range is defined manually with mouse. Bart Have a look at this event code which you can refine. No error-checking for data in the selected range...........assumes the mergerange is empty when selected. Runs when a value is selected from Combobox1 Private Sub ComboBox1_Change() Set srng = Application.InputBox(prompt:= _ "Select A Range", Type:=8) With srng .HorizontalAlignment = xlCen...

Word 2007 crasshes when selecting advanced properties
When I click the office button, prepare, properties and then select advanced properties from the document properties drop down, Word closes immediately. No error message is displayed and nothing shows up in the event viewer. This same behavior occurs in Excel 2007. I'm running XP SP3 and Office 2007 SP2. Any help would be appreciated. Have you run the Office Repair option? It may also be another symptom of a corrupt Word Data key (see below): -- That may be a symptom of a Word Data Key corruption - usually because Word has been running when updates are installed. ...

select with linq distinct Tagnames from xml-source
hello, I have the following xml source <root> <rec> <id/> <name/> <price/> </rec> <rec> <id/> <name/> </rec> </root> I want to get a string List which holds all names of all children of the <rec> nodes. But only once. so the desired resultlist should contain the elements "id","name","price" I fail to achieve this with a Linq "select". Can anybody give me a clue. thanks Mark Markus Ohlenroth wrote: > <root> > <rec> > <id/> > <name/> > &...

Selecting an item from a list
Help! I am going round in circles trying to resolve this, I have a workbook with two sheets in it the following sheet detailed as below and named Prices Code Type Size Price A011001 8 tier super 600mm =A310.00 A011002 8 tier super special 600mm =A315.00 A011004 8 tier mega 600mm =A320.00 A011005 9 tier super 600mm =A310.00 A011006 9 tier super special 600mm =A310.00 A011053 9 tier mega 600mm =A310.00 And in the same workbook I have a sheet called Order Sheet, in the order sheet I would like to pick the items up in the Prices worksheet but I cannot work out the formula ...

autoshapes
I've come across several "dots" throughout my worksheet that I've discovered are Autoshapes. When I attempt to delete them (select and "delete"), they remain. Ideas, please! Hi you could try edit / goto / special / objects and then press the delete key ... Cheers JulieD "NoNoNannette" <NoNoNannette@discussions.microsoft.com> wrote in message news:85203E6F-3C76-4983-9FE9-903F6FE0E172@microsoft.com... > I've come across several "dots" throughout my worksheet that I've > discovered > are Autoshapes. When I attempt to d...

Macro to selectively hide columns
Hi Guys, Am using MS Excel 2002. Simply, I have the following columns: May-04 | Jun-04 | Jul-04 | Aug-04 | Sep-04 | Oct-04 | Nov-04 Above this a user can choose to view the spreadsheet by any combinatio of months (e.g. just May-04 - hide Jun-04, Jul-04, Aug-04, Sep-04, Oct-04, Nov-04 May-04 to Jun-04 - hide Jul-04,Aug-04,Sep-04,Oct-04,Nov-04 Aug-04 to Oct-04 - hide May-04,Jun-04,Jul-04,Nov-04 Currently I am invoking a change event to tell the following macro t hide the corresponding fields. This is done via a drop down lis currently. Ideally, the user would be able to key in the range...

Select Specific Data From Cells For A Chart
I have a spreadsheet that has a row that I want to use as a data range in a chart. The cells in the row contain three numbers on the left and three letters on the right. I can select just the three numbers by using “LEFT(A1:Z1,3)”. How do I use that formula to select just the three numbers for the data range in the chart? Note that your formula is incorrect in what you think it does, the LEFT function cannot reference a range of cells. To reference the first 3 cells in a row: =OFFSET(A1,,,,3) To reference cells C1:E1 would be: =OFFSET(A1,,2,,3) -- Best Regards, Luke...

Booklet Printing
I have set up a document on Word 2007 to print as a booklet. When I try to print it only one page prints. It looks fine in print preview but if I select preview befor printing i only get one page. I have of course selected "all" as the print range. ...

Get Label formula with get.formula(selection()) in XL-2007
Dear group, in XL-2003 I can get a label formula with get.formula(selection()), when selection is a datalabel. Trying this in XL-2007, I get a type.mismatch. Any good ideas about this? Thanks, Holger. Holger - This is a known bug in Excel 2007. This is also broken for the chart title, and I suspect other chart text elements are also broken. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Holger Gerths" <holger@gerths.de> wrote in message news:343097CF-730C-4128-A575-F09...

Selected item on the Duration drop-down menu/combo box of an activity
Hello all, I have a client-side question, I presume. By default, the value in the Duration field of any activity is set to 30 minutes. Now, I have put an onLoad JavaScript that changes the values in the drop-down, but even if I leave out "30 minutes" value, it still remains the default written into the Duration field. I tried different ideas like document.getElementById("actualdurationminutesSelect").selectedIndex = 0; or similar but I can't change it - it always default to 30 minutes. How could I override these settings and make the first item on the list s...

Adding new folders for "Look In:" when selecting File -> Open
How do I add new "places" in the File -> Open panel specifically the "Look In:" pre-selected locations? Thanks! Open the File|Open dialog Traverse to the folder that you want to add Click on Tools, then Add to my places If you don't see see that option, share the version of excel you're using. Big UT Fan wrote: > > How do I add new "places" in the File -> Open panel specifically the "Look > In:" pre-selected locations? Thanks! -- Dave Peterson I don't believe you can. That dialog is actually control...

Select names sort sequence -- Outlook 2003
In Outlook 2003 ... when I go to send a new mail message via the sequence Send/To/Select Names, the Select Names list does not alphabetize by last name even though all three ways the name appears in Contacts are set up as Last, First. The names imported from my previous address book (Outlook Express, Win 98), are alphabetized Last/First. They work fine. The names newly entered into Contacts are the ones that will not come up by last name no matter what I try. So when I hunt for, say, Samuel Jones by typing Jones into the "Type name or select from list" box, the message will not addre...

Selective counting of database entries
Some of you may remember that my main translation memory software (D�j� Vu from Atril - see www.atril.com) is based on MS Access (97 / 2000) - see previous discussion at <http://groups.google.com/group/microsoft.public.access/browse_frm/thread/f5dead96c1d3c65d/>. The translation memory databases have 'Client' and 'Subject' attributes, among others. I would like to count the number of entries contained in my main database for specific client/subject combinations (and for some clients I would also like to count the number of words). I assumed that this would possib...

Delete RAW properties from a multiple selection of Mailboxes at on
Dear Reader, I like to delete some RAW properties (THE ADC-Global-Names atribute) from all my mailboxes in my recipients container of my Exchagne 5.5 (sp4) Mail server. When I select more that one mailbox I cannot open the raw properties of the mailboxes. Is there a way to delete the properties of a muliple selection of mailboxes, or do I have to deletel them for all my 200 mailboxes one by one? Maybe there is a way to delete the complete ADC-Global-Names attribute from my exchange server. Can anyone help me with this subject. Kind regards, Marijn Verwijs http://support.microsoft.c...

Selecting Certain Cells
I'm making an input sheet and I want the user to only be able to select certain cells. I've got the sheet protected so that a user can only enter data into certain cells, but I can still use the mouse and select other cells on the spreadsheet. Is there a way to do this? Thanks!!! Hi! In the Protection dialogue boxes there are many options that you can set including whether to allow users to select locked cells. Goto Tools>Protection>Protect sheet and a list of those options should appear. Also, you must first select which cells are to be locked. To do this go throu...

Columns Selected
I'm having some issues with trying to get this code to work properly. What this is trying to do is record changes made to the columns containing the Part Number, Qty and Unit Cost. I had it working fine if the user only changed one cell at a time, I was able to pick up the row/column and produce the change. The issue is that if the user selects a range and deletes it or drag and drop or xlFillDown, I can't figure out how to record it properly - however I'm getting close. My main issue right now is I want to only build the array if the range contains the columns I am in...

select all
How do I select all from my contacts? > How do I select all from my contacts? Select the first, hold the shift key down and select the last. All will become highlighted. Or... Hold the Ctrl key down when you select as many as you want individually. -Frank Highlight one and Ctrl + A will highlight all of them. -- Bruce Hagen MS-MVP [Mail] Imperial Beach, CA "lk-kosh@centurytel.net" <lk-kosh@centurytel.net@discussions.microsoft.com> wrote in message news:641A1FE6-B716-42B6-948F-0E0346337BD3@microsoft.com... > ...