Sorry, you do not have permission to ask a question.

Sorry, you do not have permission to add post.

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.

Aurora Telekom Logo Aurora Telekom Logo

Aurora Telekom

Aurora Telekom Navigation

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

Mobile menu

Close
Ask A Question
  • Home
  • About Us
  • Blog
  • Contact Us
Home/ Questions/Q 202
Next

Aurora Telekom Latest Questions

Questioner
  • 0
  • 0
Questioner
Asked: December 3, 20242024-12-03T13:49:10+00:00 2024-12-03T13:49:10+00:00In: Language

Trying to create a process that counts records from a MariaDB and stores the result in another table

  • 0
  • 0
Howdy folks,

I’m building a process in my Node server that counts each record at the end of every day and stores them in another table. I’ll use this table later to create charts, etc.

I want to ensure that it only counts the data within that particular day. So far, I have a cron that runs a function and queries the database, asking for the counts from a particular table (in the example below, I’m using the bounces table).

My question is, can I query the database table for the records added in the last 24 hours? (note: I’m storing UNIX timestamps).

JavaScript:
const job = new CronJob(
'* * * * *',
function(){
  calculateData();
},
null,
true,
'America/Los_Angeles'

);

async function calculateData(){
  const con = await mysqlConnect();
  const sql = "SELECT COUNT(*), created FROM bounces GROUP BY created";

  return new Promise((resolve, reject) => {
    con.query(sql, function (err, result) {
      con.release();

      if (err) {
        console.error("Error queying database:", err);
        reject(err);
      } else {

        result.forEach((rawDataPacket) => {
          console.log(rawDataPacket, "worked")
        });

        resolve(result);
      }
    });
  });
  console.log("hey")
}
english
  • 0 0 Answers
  • 109 Views
  • 0 Followers
  • 0
    • Report
  • Share
    Share
    • Share on Facebook
    • Share on Twitter
    • Share on LinkedIn
    • Share on WhatsApp
Leave an answer

Leave an answer
Cancel reply

Browse

Sidebar

Ask A Question

Stats

  • Questions 86
  • Answers 3
  • Best Answers 0
  • Users 3
  • Popular
  • Answers
  • Questioner

    How do native speakers tell I’m foreign based on my ...

    • 3 Answers
  • Questioner

    Funbahis Giriş Güncel Giriş Linki 2024

    • 0 Answers
  • Questioner

    Trying to create a simple linear regression module but getting

    • 0 Answers
  • James Wane
    James Wane added an answer Because non-native speakers use English differently as compared to native… April 19, 2018 at 2:03 am
  • Barry Carter
    Barry Carter added an answer You probably have strange grammar. Pretty much every language has… April 19, 2018 at 2:03 am
  • John Peter
    John Peter added an answer It may be little things like not using native idioms,… April 19, 2018 at 2:03 am

Related Questions

  • Redwin Giriş Güncel Giriş Linki 2024

    • 0 Answers
  • Trying to create a simple linear regression module but getting

    • 0 Answers
  • Trying to create a simple linear regression module but getting

    • 0 Answers
  • update the colorbar visualsation from the previous to the new ...

    • 0 Answers
  • Betcup Giriş Güncel Giriş Linki 2024

    • 0 Answers

Top Members

Trending Tags

english

Explore

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

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.