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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:42:40+00:00 2026-05-25T23:42:40+00:00

SELECT datecreated, totcount FROM (SELECT REPLACE(RIGHT(CONVERT(VARCHAR(9), tof.create_stamp, 6), 6), ‘ ‘, ‘ ‘) AS

  • 0
SELECT datecreated,
       totcount
FROM  (SELECT REPLACE(RIGHT(CONVERT(VARCHAR(9), tof.create_stamp, 6), 6), ' ', ' ') AS datecreated,
              COUNT(DISTINCT tof.unique_id)                                         AS totcount
       FROM   trn_open_files tof
              JOIN trn_debtor tb
                ON ( tof.unique_id = tb.unique_id
                     AND tb.debtor_seq_num = 1
                     AND tb.rec_status = 'R' )
              JOIN trn_property tp
                ON ( tof.unique_id = tp.unique_id )
              LEFT OUTER JOIN trn_parties prty_cccs
                ON ( prty_cccs.unique_id = tof.unique_id
                     AND prty_cccs.party_role = 'CCCS'
                     AND prty_cccs.rec_status = 'A' )
              LEFT OUTER JOIN trn_parties prty_srv
                ON ( prty_srv.unique_id = tof.unique_id
                     AND prty_srv.party_role = 'SRV'
                     AND prty_srv.rec_status = 'A' )
              LEFT OUTER JOIN trn_parties prty_vend
                ON ( prty_vend.unique_id = tof.unique_id
                     AND prty_vend.party_role = 'CLMO'
                     AND prty_vend.rec_status = 'A' )
              LEFT OUTER JOIN trn_parties prty_ins
                ON ( prty_ins.unique_id = tof.unique_id
                     AND prty_ins.party_role = 'INS'
                     AND prty_ins.rec_status = 'A' )
              LEFT OUTER JOIN trn_parties prty_ss
                ON ( prty_ss.unique_id = tof.unique_id
                     AND prty_ss.party_role = 'SS'
                     AND prty_ss.rec_status = 'A' )
              LEFT OUTER JOIN trn_parties prty_realtor
                ON ( prty_realtor.unique_id = tof.unique_id
                     AND prty_realtor.party_role = 'REALTOR'
                     AND prty_realtor.rec_status = 'A' )
              LEFT OUTER JOIN mst_comp_info mci1
                ON ( mci1.comp_id = prty_cccs.party_comp_id
                     AND mci1.comp_type = 'CCCS'
                     AND mci1.rec_status = 'A' )
              LEFT OUTER JOIN mst_comp_info mci
                ON ( mci.comp_id = prty_srv.party_comp_id
                     AND mci.comp_type = 'SRV'
                     AND mci.rec_status = 'A'
                     AND mci.pilot_flag = 'Y' )
              LEFT OUTER JOIN mst_comp_info mci2
                ON ( mci2.comp_id = prty_vend.party_comp_id
                     AND mci2.comp_type = 'VEND'
                     AND mci2.rec_status = 'A' )
              LEFT OUTER JOIN mst_comp_info mci3
                ON ( mci3.comp_id = prty_ins.party_comp_id
                     AND mci3.comp_type = 'INS'
                     AND mci3.rec_status = 'A' )
              LEFT OUTER JOIN mst_comp_info mci4
                ON ( mci4.comp_id = prty_ss.party_comp_id
                     AND mci4.comp_type = 'SS'
                     AND mci4.rec_status = 'A' )
              LEFT OUTER JOIN mst_comp_info mci5
                ON ( mci5.comp_id = prty_realtor.party_comp_id
                     AND mci4.comp_type = 'REALTOR'
                     AND mci4.rec_status = 'A' )
              LEFT OUTER JOIN mst_status_codes i
                ON ( i.status_code = tof.case_status
                     AND i.comp_id = tof.comp_id
                     AND ( i.party_role IS NULL
                            OR i.party_role = 'VEND' )
                     AND tof.file_type = i.file_type )
       WHERE  tof.cur_status = 'A'
              AND tof.cms_flag = 'Y'
              AND CONVERT(DATE, tof.create_stamp) >= CONVERT(DATE, '2010-06-06')
              AND CONVERT(DATE, tof.create_stamp) <= CONVERT(DATE, '2011-10-01')
              AND prty_cccs.party_comp_id = 10153
              AND prty_cccs.party_comp_id = 10153
       GROUP  BY REPLACE(RIGHT(CONVERT(VARCHAR(9), tof.create_stamp, 6), 6), ' ', ' '),
                 prty_cccs.party_comp_id) q1  

having this procedure how to show month in proper sequence.

now month is appear as

out put: DateCreated totcount

Sep 11 7
May 11 2
Jun 11 10
Jul 11 40
Aug 11 144

i want month in sequence like DateCreated totcount

May 11 2
Jun 11 10
Jul 11 40
Aug 11 144
Sep 11 7
  • 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-25T23:42:41+00:00Added an answer on May 25, 2026 at 11:42 pm

    Not tested but I think you should replace REPLACE(RIGHT(CONVERT(VARCHAR(9), tof.create_stamp, 6), 6), ' ', ' ') with dateadd(month, datediff(month, 0, tof.create_stamp), 0) and do the presentation thing in the outer query. And adding an order by to the outer query ORDER BY q1.datecreated.

    SELECT REPLACE(RIGHT(CONVERT(VARCHAR(9), datecreated, 6), 6), ' ', ' '),
           totcount
    FROM   (SELECT Dateadd(MONTH, Datediff(MONTH, 0, tof.create_stamp), 0) AS datecreated,
                   COUNT(DISTINCT tof.unique_id)                           AS totcount
            FROM   trn_open_files tof
                   JOIN trn_debtor tb
                     ON ( tof.unique_id = tb.unique_id
                          AND tb.debtor_seq_num = 1
                          AND tb.rec_status = 'R' )
                   JOIN trn_property tp
                     ON ( tof.unique_id = tp.unique_id )
                   LEFT OUTER JOIN trn_parties prty_cccs
                     ON ( prty_cccs.unique_id = tof.unique_id
                          AND prty_cccs.party_role = 'CCCS'
                          AND prty_cccs.rec_status = 'A' )
                   LEFT OUTER JOIN trn_parties prty_srv
                     ON ( prty_srv.unique_id = tof.unique_id
                          AND prty_srv.party_role = 'SRV'
                          AND prty_srv.rec_status = 'A' )
                   LEFT OUTER JOIN trn_parties prty_vend
                     ON ( prty_vend.unique_id = tof.unique_id
                          AND prty_vend.party_role = 'CLMO'
                          AND prty_vend.rec_status = 'A' )
                   LEFT OUTER JOIN trn_parties prty_ins
                     ON ( prty_ins.unique_id = tof.unique_id
                          AND prty_ins.party_role = 'INS'
                          AND prty_ins.rec_status = 'A' )
                   LEFT OUTER JOIN trn_parties prty_ss
                     ON ( prty_ss.unique_id = tof.unique_id
                          AND prty_ss.party_role = 'SS'
                          AND prty_ss.rec_status = 'A' )
                   LEFT OUTER JOIN trn_parties prty_realtor
                     ON ( prty_realtor.unique_id = tof.unique_id
                          AND prty_realtor.party_role = 'REALTOR'
                          AND prty_realtor.rec_status = 'A' )
                   LEFT OUTER JOIN mst_comp_info mci1
                     ON ( mci1.comp_id = prty_cccs.party_comp_id
                          AND mci1.comp_type = 'CCCS'
                          AND mci1.rec_status = 'A' )
                   LEFT OUTER JOIN mst_comp_info mci
                     ON ( mci.comp_id = prty_srv.party_comp_id
                          AND mci.comp_type = 'SRV'
                          AND mci.rec_status = 'A'
                          AND mci.pilot_flag = 'Y' )
                   LEFT OUTER JOIN mst_comp_info mci2
                     ON ( mci2.comp_id = prty_vend.party_comp_id
                          AND mci2.comp_type = 'VEND'
                          AND mci2.rec_status = 'A' )
                   LEFT OUTER JOIN mst_comp_info mci3
                     ON ( mci3.comp_id = prty_ins.party_comp_id
                          AND mci3.comp_type = 'INS'
                          AND mci3.rec_status = 'A' )
                   LEFT OUTER JOIN mst_comp_info mci4
                     ON ( mci4.comp_id = prty_ss.party_comp_id
                          AND mci4.comp_type = 'SS'
                          AND mci4.rec_status = 'A' )
                   LEFT OUTER JOIN mst_comp_info mci5
                     ON ( mci5.comp_id = prty_realtor.party_comp_id
                          AND mci4.comp_type = 'REALTOR'
                          AND mci4.rec_status = 'A' )
                   LEFT OUTER JOIN mst_status_codes i
                     ON ( i.status_code = tof.case_status
                          AND i.comp_id = tof.comp_id
                          AND ( i.party_role IS NULL
                                 OR i.party_role = 'VEND' )
                          AND tof.file_type = i.file_type )
            WHERE  tof.cur_status = 'A'
                   AND tof.cms_flag = 'Y'
                   AND CONVERT(DATE, tof.create_stamp) >= CONVERT(DATE, '2010-06-06')
                   AND CONVERT(DATE, tof.create_stamp) <= CONVERT(DATE, '2011-10-01')
                   AND prty_cccs.party_comp_id = 10153
                   AND prty_cccs.party_comp_id = 10153
            GROUP  BY Dateadd(MONTH, Datediff(MONTH, 0, tof.create_stamp), 0),
                      prty_cccs.party_comp_id) q1  
    ORDER BY q1.datecreated
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

select source_of_data, convert(varchar(10),a.DATECREATED,101), COUNT(*) from some_table a group by source_of_data, convert(varchar(10),a.DATECREATED,101) order by source_of_data,
select * from sampleTable where CONVERT(VARCHAR(20),DateCreated,101) = CONVERT(VARCHAR(20),CAST('Feb 15 2012 7:00:00:000PM' AS DATETIME),101) I
i have this simple query : SELECT YEAR(P.DateCreated) ,MONTH(P.DateCreated) ,COUNT(*) AS cnt FROM tbl1,
SELECT REPLACE([strUrl], '/myoldurl', '/mynewurl') FROM [UrlRewrite] If strUrl is /myoldurl/myoldurl_something_else , it returns /mynewurl/mynewurl_something_else
SELECT Id, to, Subject, Body, DateCreated, DateSent FROM Emails Gives the following error: Msg
Issuing the following query: SELECT t.seq, t.buddyId, t.mode, t.type, t.dtCreated FROM MIM t WHERE
SELECT Id,Date,Name FROM people WHERE DATEPART(hh,Date) >= 7 AND DATEPART(hh,Date) <= 8 Order by
select tf.Id,tf.Name,tf.LName,tf.Rank,tf.Category where tf.Id not in (select fighter_id from tbl_player_fighter where league_id=91) and tf.Status
SELECT * From `users` AS `User` LEFT JOIN `selections` AS `Selections` ON (`Selections`.`user_id` =
SELECT * FROM list WHERE list_item LIKE %_1375_% returns results it should not. For

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.