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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:13:18+00:00 2026-05-28T02:13:18+00:00

I’m very new to scripting and SQL and I’ve inherited a crazy database generated

  • 0

I’m very new to scripting and SQL and I’ve inherited a crazy database generated by some contact management software. I’m running Microsoft SQL Server 2005. What I’m trying to do is select rows that meet certain conditions (the most important being that BIRTHDATE is today’s date, which seems like it may be my issue). Here is my code:

SELECT 
  TBL_CONTACT.BIRTHDATE, 
  TBL_CONTACT.COMPANYNAME, 
  TBL_CONTACT.CATEGORY, 
  CUST_ContactTable1_074000.CUST_DesignatedAgent_074203199, 
  TBL_EMAIL.ADDRESS 
FROM 
  TBL_CONTACT, 
  CUST_ContactTable1_074000,
  TBL_EMAIL
WHERE 
  TBL_CONTACT.BIRTHDATE >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0) AND 
  TBL_CONTACT.BIRTHDATE < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1) AND 
  TBL_CONTACT.CATEGORY = 'Active' AND TBL_EMAIL.ADDRESS IS NOT NULL AND 
  CUST_ContactTable1_074000.CUST_DesignatedAgent_074203199 IS NOT NULL

The issue is that it’s returning all the rows in my database (minus the records not meeting the NOT NULL and CATEGORY = ‘Active’ conditions, it appears) even though there should be only one row that has the correct TBL_CONTACT.BIRTHDATE. It is putting the BIRTHDATE of the only row that should work down the entire list, even though those rows should have BIRTHDATE’s that aren’t today’s date. If I make it so there are no BIRTHDATE’s that match today’s, nothing gets returned (which is what I expect).

What am I doing wrong? Please explain your answer as I am looking to learn. Thank you!

  • 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-28T02:13:19+00:00Added an answer on May 28, 2026 at 2:13 am

    Where are your join conditions between table?
    As it stands, you have a cross join a.k.a Cartesian product

    ...
    FROM 
       TBL_CONTACT C
       JOIN
       CUST_ContactTable1_074000 CT ON C.Something = CT.Something
       JOIN
       TBL_EMAIL E ON C.Anotherthing = CT.Anotherthing
    WHERE
       ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a reasonable size flat file database of text documents mostly saved in
I have some data like this: 1 2 3 4 5 9 2 6

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.