Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

select with subquery in select clause

 
   Database Help (Home) -> Server RSS
Next:  Sr Developer ,SFO  
Author Message
jrchaveztj

External


Since: Aug 07, 2010
Posts: 1



(Msg. 1) Posted: Sat Aug 07, 2010 1:25 pm
Post subject: select with subquery in select clause
Archived from groups: microsoft>public>sqlserver>server (more info?)

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

 >> Stay informed about: select with subquery in select clause 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
select count(*) from another select - I am trying to get the total number of records returned by the following query. The query is: SELECT T.ID FROM tblTickets T, tblTicketHistory H WHERE T.Closed = 1 AND T.ID = H.TicketID GROUP BY T.ID HAVING COUNT(H.TicketID) < 2 This returns 11 rows...

Select * - They say that Select * is not godd for performace issue. What if the result required contains all the columns of the table. Should we still use : Selec col1,cl2,col3 from tablename or Select * from tablename Should be OK ? Thanks

SELECT - The database scheme consists of four relations: Product(maker, model, type) PC(code, model, speed, ram, hd, cd, price) Laptop(code, model, speed, ram, hd, screen, price) Printer(code, model, color, type, price) The relation "Product" shows th...

select statement - Hi, I tried to run a sql select statement query like the following in SQL 2005 management studio: select * from table where field.value = a Then I get hang up and it is running and running and never end. So I trie...

select system_user - Hi, I need to keep track of user/program update sql table. I created a trigger for the update user filed by update instacontrol set username = system_user where intmid = (select intmid from inserted) Now I need to remote host name which does the..
   Database Help (Home) -> Server All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]