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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:08:29+00:00 2026-06-13T00:08:29+00:00

I am downloading data from a 3rd party datasource and one field is a

  • 0

I am downloading data from a 3rd party datasource and one field is a contact’s birthday, which may be blank i.e. 0000-00-00. My users have the option of entering the contact’s birthday if they choose, and I hold this is in a separate table because if I updated the original table, whenever the user refreshed with the original datasource, all updated birthdays would be erased.

I now want to find all birthdays in next 30 days. This works on the first (original datasource) table:

    $BirthdayResults = mysql_query("SELECT * FROM Connections WHERE UserID='$UserID' AND (DATE_FORMAT(ContactBirthday, '%m%d') BETWEEN '$sCurrentDate' AND '$sDateOneMonthAdded')");    

So I am wondering if mySQL can handle this type of logic:

$BirthdayResults = mysql_query("SELECT * FROM Connections WHERE UserID='$UserID'... 
 AND IF ContactBirthday IN Connections = '0000-00-00' 
 CHECK OTHER_BIRTHDAY_TABLE AND USE THIS BIRTHDAY IF IT EXISTS 
 WHERE Connections.ContactID=OTHER_BIRTHDAY_TABLE.ContactID
  • 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-13T00:08:30+00:00Added an answer on June 13, 2026 at 12:08 am
    SELECT *
    FROM   Connections LEFT JOIN OTHER_BIRTHDAY_TABLE USING(ContactID)
    WHERE  UserID='$UserID'
       AND DATE_FORMAT(
             IF(
               Connections.ContactBirthday = '0000-00-00',
               OTHER_BIRTHDAY_TABLE.BIRTHDAY,
               Connections.ContactBirthday
             ),
             '%m%d'
           ) BETWEEN '$sCurrentDate' AND '$sDateOneMonthAdded'
    

    However, NULL would be more appropriate than 0000-00-00 in this situation; in which case one could use MySQL’s IFNULL() or COALESCE() functions instead:

           DATE_FORMAT(
             IFNULL(Connections.ContactBirthday, OTHER_BIRTHDAY_TABLE.BIRTHDAY),
             '%m%d'
           )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have c# code behind my Excel-dna addin which is successfully downloading data from
I am downloading large data from ASynchronous NSURLConnection in one separate viewcontroller.it takes 2
I have a doubt regarding downloading data from a web service. One way is
I'm working on an iPhone App which involves downloading data from a web server.
My program is downloading data from a server, once he received all the data,
I am downloading data from a php file using miniAjax. Here is what the
I am creating an application wherein I am downloading some data from server. While
I am downloading some very large data from a server with the NSURLConnection class.
I am downloading a CSV file from another server as a data feed from
i am downloading data from website using asynctask and my code for async task

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.