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 7406289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:32:07+00:00 2026-05-29T05:32:07+00:00

So I have a query to filter a bunch of records: declare @rDate_datepart datetime

  • 0

So I have a query to filter a bunch of records:

declare @rDate_datepart datetime
-- this gets rid of any time information, so we have just the date (i.e, right at midnight of that day)
set @rDate_datepart = convert(datetime,convert(varchar(2),datepart("m",'2/3/2012'))+'/'+convert(varchar(2),datepart("dd",'2/3/2012'))+'/'+convert(varchar(4),datepart("yyyy",'2/3/2012')))

select tq_tran_quote_id, MAX_MATURITY_DT.cm_maturity_dt
from cfo_tran_quote inner join cfo_transaction
    on tq_tr_transaction_id = tr_transaction_id
left join com_lock on tr_transaction_id = lk_tr_transaction_id
LEFT OUTER JOIN 
(
    SELECT cm_tq_tran_quote_id, MAX(cm_maturity_dt) as 'cm_maturity_dt'
    FROM cfo_component
    GROUP BY cm_tq_tran_quote_id
) AS MAX_MATURITY_DT ON MAX_MATURITY_DT.cm_tq_tran_quote_id = tq_tran_quote_id
where tq_dd_tran_qt_status = 'Matured' and
    isnull(lk_rv_lock_status, 10104) = 10104 and
MAX_MATURITY_DT.cm_maturity_dt between @rDate_datepart - 15 and @rDate_datepart 
and tq_dd_product in 
        (select pr_dd_product 
        from cfo_product 
        where pr_dd_product_type = 'Cash Flow') 

Now I basically want to add something to this query that says, give me all of the rows this query brought back where these specific tq_tran_quote_id‘s do not have records in another table cfo_daily_trans_hist where their dh_valuation_total in that other table is 0.

Does that make sense?

I’m terrible with SQL…lol

  • 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-05-29T05:32:08+00:00Added an answer on May 29, 2026 at 5:32 am

    All you have to do is take your entire query and add:

    WHERE tq_tran_quote_id NOT IN (SELECT tq_tran_quote_id FROM MyOtherTable WHERE dh_valuation_total=0)

    Basically it answers your question:

    Now I basically want to add something to this query that says, give me
    all of the rows this query brought back where these specific
    tq_tran_quote_id’s do not have records in another table
    cfo_daily_trans_hist where their dh_valuation_total in that other
    table is 0.

    It just says WHERE this tq_tran_quote_id is not in the “other table” which you will want to replace MyOtherTable with the real name of your table where their dh_valuation_total is 0.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a query that looks like this: { query: { constant_score: filter: {
I have the following sql query and I want to filter the results where
I have query to the db, where I ask for specific entries. This is
I have query with two MtM relations: $em = $this->getEntityManager(); $qb = $em->createQueryBuilder(); $qb
I have query like this : SELECT EXTRACT(MONTH FROM d.mydate) AS synmonth, SUM(apcp) AS
In Django, one can append query results as so: query.filter(...). Does Code Igniter have
I'm looking for more information how to modify Postgres 9..0 query plan. I have
I have the following filter query which is doing an SQL OR statement: results
I have a query in a php string which i am trying to filter
I have this query. Which seems to be giving me complications. It works if

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.