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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:47:12+00:00 2026-05-28T05:47:12+00:00

I have a database with 2 tables that I am working with (SugarCRM). I

  • 0

I have a database with 2 tables that I am working with (SugarCRM).

I am querying the table cases_audit to get a row count of cases with a status changed to closed. All this works great.

What I am having trouble with is figuring out how to take the id from cases_audit and ensure that under table cases that same id has a type = “support”

// Query cases_aduit to find out how many cases were closed -0 days ago
$query_date_1_closed = "select * from cases_audit where after_value_string = 'Closed' and date_created LIKE '$date_1 %'";
$rs_date_1_closed = mysql_query($query_date_1_closed);
$num_rows_1_closed = mysql_num_rows($rs_date_1_closed);
  • 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-28T05:47:12+00:00Added an answer on May 28, 2026 at 5:47 am

    Assuming the column id in cases_audit referes to id in cases (which is not very likely), this query gives you every column from the audit plus type from the appropriate case:

    SELECT
        A.*, C.type
    FROM cases_audit A
        INNER JOIN cases C ON A.id=C.id
    WHERE A.after_value_string = 'Closed' AND A.date_created LIKE '$date_1 %'
    

    If you want to count the closed support cases, add C.type to your WHERE condition:

    SELECT
        COUNT(*)
    FROM cases_audit A
        INNER JOIN cases C ON A.id=C.id
    WHERE A.after_value_string = 'Closed' AND A.date_created LIKE '$date_1 %' AND C.type = 'support'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my database I have tables that define types for example Table: Publication Types
I have a database two tables and a linking table that I need a
I have a database that has node & nodetype tables. Nodes table NodeID ParentNodeID
I have 2 database tables that looks like this Subscriptions table member_id active 5
I'm working on databases that have moving tables auto-generated by some obscure tools. By
I have several database tables that just contain a single column and very few
I have an SQL database with a set of tables that have Unique Id's.
I have a large database with over 150 tables that I've recently been handed.
I have a relatively large database tables (just under a million rows) that has
I heard that decision tables in relational database have been researched a lot in

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.