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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:08:55+00:00 2026-05-24T00:08:55+00:00

I currently have a query in my database that determines the amount of time

  • 0

I currently have a query in my database that determines the amount of time that has passed between the time the record was and the time that you are viewing it, it looks like this:

SELECT d.ID, Age AS Expr1, DateDiff("h",d.dateOpened,Now()) & " hrs" AS Age, fl.flavorname, pkg.package, st.status
FROM lut_status AS st INNER JOIN (lut_flavorname AS fl INNER JOIN (lut_packaging AS pkg INNER JOIN record_holddata AS d ON pkg.id = d.package) ON fl.id = d.flavor) ON st.id = d.holdstatus
WHERE (((d.holdStatus)<>7))
ORDER BY d.dateOpened;

There is also a field in that record_holdData table called finalDispoDate that holds a date that the hold item was closed. What I want to do is create a similar query that will use the current time to determine the age of the hold but only if the finalDispoDate field is null; otherwise it will use the value in the finalDispoDate to determine the age of the hold (time between it being created and it being dispositioned).

I know how I would do this programatically but with the way i have my binding set up, I would rather accomplish this in the query. Wasn’t able to find any good examples of this on the net. Any ideas on how I would accomplish this? tia

  • 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-24T00:08:56+00:00Added an answer on May 24, 2026 at 12:08 am

    You could apply the Nz function instead so if the value is NULL you will set a default value for it, here is an example:

    SELECT d.ID, Nz(d.another, “Nop”) from lut_status

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

Sidebar

Related Questions

I currently have a query that looks like this: SELECT NON EMPTY ([Measures].[TOTAL]) ON
I have a database that looks like this: (dates are formated with strtotime )
I currently have a bunch of SQLCHAR objects from a database query. The query
I currently have a SQL query that returns a number of fields. I need
Hey guys I have a query that currently finds the latest comment for each
Dear all, I have a select query that currently produces the following results: DoctorName
I'd like to query a database and upload entries from that database into fields
I have a MySQL database that currently uses MyISAM but I am thinking of
I currently have a database that within a loop checks a table if a
I have a Sql Server 2008 Express database file that's currently being used by

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.