Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7907793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:38:17+00:00 2026-06-03T11:38:17+00:00

I have a select which returns a duration value. what i would like to

  • 0

I have a select which returns a duration value. what i would like to do is look up this value in a lookup table and return a value for yield which is closest to this duration value.

e.g

i have a duration of 0.20 for USD so from my look up table below which is derived from this code:

select fld1_val, mrkt_cap_wght from dw_iss_indx_cnstnt AS ai WITH (NOLOCK)

INNER JOIN  dw_issue_dg AS i WITH (NOLOCK)
  ON ai.indx_instr_id = i.instr_id 
  AND ai.as_of_dte > getdate()-2

INNER JOIN dw_issue_alt_id AS ia WITH (NOLOCK)
  on ia.instr_id = ai.indx_instr_id
  AND id_ctxt_typ = 'Bloomberg ID'
  AND denom_curr_cde = 'USD'

this returns:

fld1_val    mrkt_cap_wght
0.08        5.0168
0.25        5.03
0.5         5.09
1           5.21
2           5.2
5           5.51
10          5.67
12          5.69
15          5.7
20          5.71

So what i would do is lookup against this and because 0.20 is closest to 0.25 i would return 5.03 as my yield.

However i am unsure of how to do this as the look up is not looking for an exact match, just a closest to value. Any idea how i could do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T11:38:20+00:00Added an answer on June 3, 2026 at 11:38 am
    DECLARE @Dur decimal(5,2)=0.20;
    
    select TOP 1 fld1_val, mrkt_cap_wght from dw_iss_indx_cnstnt AS ai WITH (NOLOCK)
    
    INNER JOIN  dw_issue_dg AS i WITH (NOLOCK)
      ON ai.indx_instr_id = i.instr_id 
      AND ai.as_of_dte > getdate()-2
    
    INNER JOIN dw_issue_alt_id AS ia WITH (NOLOCK)
      on ia.instr_id = ai.indx_instr_id
      AND id_ctxt_typ = 'Bloomberg ID'
      AND denom_curr_cde = 'USD'
    ORDER BY ABS(@Dur-fld1_val)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have SELECT name FROM table which gives me something like foo
I have this query SELECT ?s WHERE {?a <http://xmlns.com/foaf/0.1/topic_interest> ?s} which returns aaa aaa
I have this: SELECT AssignmentID FROM ProblemView GROUP BY AssignmentID which returns 32 rows.
I have a UDF which returns table variable like -- -- RETURNS @ElementTable TABLE
i have a table like this: +------------------------+ |Key| value | name | +---+-------+------------+ 1
I have a select statement which is something like this select col1 from table1
I have a Stored proc which returns 6 select statement results. I'm trying to
i have a table with columns ID,SUBJECT,BRANCH i have select the rows which satisfies
I have 6 columns in a table. I have a select query which selects
I have the following LINQ Select which does not work. Data.Select(d => d.Value.IsDirty =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.