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

  • Home
  • SEARCH
  • 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 8500083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:50:46+00:00 2026-06-11T00:50:46+00:00

I have a table like below CREATE TABLE Customers_History(Row_Id INT NOT NULL PRIMARY KEY

  • 0

I have a table like below

      CREATE TABLE Customers_History(Row_Id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
                             Cust_Name VARCHAR(255),
                             Created_Date DATE,
                             Cust_Status TINYINT)

The rows in the table are below


INSERT INTO Customers_History(Cust_Name, Created_Date, Cust_Status)
                     VALUES('Customer A', '20120516', 0),
                           ('Customer B', '20120516', 0),
                           ('Customer C', '20120516', 0),

                           ('Customer A', '20120517', 1),
                           ('Customer B', '20120517', 0),
                           ('Customer C', '20120517', 0),

                           ('Customer A', '20120520', 1),
                           ('Customer B', '20120520', 0),
                           ('Customer C', '20120520', 1),

                           ('Customer A', '20120521', 0),
                           ('Customer B', '20120521', 0),
                           ('Customer C', '20120521', 1),

                           ('Customer A', '20120526', 1),
                           ('Customer B', '20120526', 1),                
                           ('Customer C', '20120526', 0);

I want a Query which Brings Output as Below by taking date as parameter

When i pass 20120517 as parameter for date in where class it should bring Customer A as its status changes from 0 to 1

  Customer A

When i pass 20120520 as parameter for date in where class it should bring Customer C as its status changes from 0 to 1

  Customer C

When i pass 20120526 as parameter for date in where class it should bring Customer B as its status changes from 0 to 1

  Customer B

I want the Customers name for particular date whose status changed from 0 to 1 for the first time.

Note : When i pass 20120526 as parameter for date in where class it should not bring Customer A since Customer A Status Changed from 0 to 1 on 17 itself.

  • 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-11T00:50:48+00:00Added an answer on June 11, 2026 at 12:50 am

    There you go:

    select
      c.Cust_Name
    from
      Customers_History c
    where
      c.CreatedDate = :YourDate and
      c.Cust_Status = 1 and
      not exists 
        ( select 
            'x' 
          from 
            Customers_History c2
          where 
            c2.Cust_Name = c.CustName and
            c2.Cust_Status = 1 and
            c2.Created_Date < c.Created_Date )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

e.g. If I have a table like below:- create table Categories(CategoryId int primary key,
I have mysql database structure like below: CREATE TABLE test ( id int(11) NOT
I have a history table like below CREATE TABLE [dbo].[t_PettyCash_History] ( [TableName] [varchar] (500)
I have a table structure like below : categoryID bigint , primary key ,
I have a table like this: create table t1 { person_id int, item_name varchar(30),
i have a table like below: create table info (username varchar(30),otherinfo varchar(100)); now i
I have a Table and Rows in table like below CREATE TABLE Areas(AreaName VARCHAR(255),
I have two table like below CREATE TABLE IF NOT EXISTS `countries` ( `id`
I have a table trigger like below: CREATE OR REPLACE TRIGGER PAT_BUR_DOB_TRG BEFORE UPDATE
I have a pg table like this: CREATE TABLE order_status_history ( order_id integer NOT

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.