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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:57:39+00:00 2026-05-20T00:57:39+00:00

I have a sql good working like this. SELECT B.HESAP_NO, A.TEKLIF_NO1 + ‘/’ +

  • 0

I have a sql good working like this.

SELECT  B.HESAP_NO, A.TEKLIF_NO1 + '/' + A.TEKLIF_NO2 AS 'TEKLIF',
B.MUS_K_ISIM, CONVERT(VARCHAR(10),A.ISL_TAR,103) AS 'TARIH',
SUM(ISNULL(CAST(A.ODENEN_ANAPARA AS FLOAT),0)+ISNULL(CAST(A.FAIZ AS FLOAT),0)+
    ISNULL(CAST(A.BSMV AS FLOAT),0)+ISNULL(CAST(A.GECIKME_FAIZ AS FLOAT),0)+
    ISNULL(CAST(A.GECIKME_BSMV AS FLOAT),0)) AS 'YATAN', 
    (CASE WHEN B.DOVIZ_KOD = 21 THEN 'EUR' WHEN B.DOVIZ_KOD = 2 THEN 'USD' WHEN B.DOVIZ_KOD = 1 THEN 'TL' END) AS 'KUR',
    D.AVUKAT, CONVERT(VARCHAR(10),C.ICRA_TAR,103) AS 'İCRA TARİHİ', CONVERT(VARCHAR(10),C.HACIZ_TAR,103) AS 'HACİZ TARİHİ'

FROM YAZ..MARDATA.BIR_TAHSIL A, YAZ..MARDATA.S_TEKLIF B, TAKIP C, AVUKAT D, P_TAKIP_SR E

WHERE A.TEKLIF_NO1 = B.TEKLIF_NO1
AND A.TEKLIF_NO2 = B.TEKLIF_NO2
AND B.HESAP_NO = D.HESAP
AND D.HESAP = A.HESAP_NO

And i add a date range with code like this.

if (txtBoxText1 != "")
    {
        strQuery = strQuery + " AND A.ISL_TAR >= @S_TARIH_B";

      dt_stb = DateTime.Parse(txtBoxText1);
      myCommand.Parameters.AddWithValue("@S_TARIH_B", dt_stb);
    }

    if (txtBoxText2 != "")
    {
        strQuery = strQuery + " AND A.ISL_TAR <= @S_TARIH_S";
      dt_sts = DateTime.Parse(txtBoxText2);
      myCommand.Parameters.AddWithValue("@S_TARIH_S", dt_sts);
    }

For the last i add GROUP BY

GROUP BY  B.HESAP_NO, A.TEKLIF_NO1 + '/' + A.TEKLIF_NO2,A.ISL_TAR,B.DOVIZ_KOD, B.HESAP_NO, B.MUS_K_ISIM, D.AVUKAT, C.ICRA_TAR, C.HACIZ_TAR

But this query gettig result for example like this (part of some)

HESAP_NO       MUS_K_ISIM     YATAN  Date
889          2M LOJİSTİK      7090   28/03/2010

Just getting one record for 28/03/2010. But in the database, in this date, there are two records.

HESAP_NO       MUS_K_ISIM     YATAN  Date
889          2M LOJİSTİK      5000   28/03/2010
889              2M LOJİSTİK      2090   28/03/2010

As you see (5000 + 2090 = 7090) adding all YATAN (number) and getting one record the top query.

What i want is, the getting all records in the same date like second result.

  HESAP_NO     MUS_K_ISIM     YATAN  Date
    889          2M LOJİSTİK      5000   28/03/2010
    889              2M LOJİSTİK      2090   28/03/2010

How can i do that?

Regars,
Soner

  • 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-20T00:57:40+00:00Added an answer on May 20, 2026 at 12:57 am

    This is happening because of your SUM function in your SELECT:

    SUM(ISNULL(CAST(A.ODENEN_ANAPARA AS FLOAT),0)+ISNULL(CAST(A.FAIZ AS FLOAT),0)+
        ISNULL(CAST(A.BSMV AS FLOAT),0)+ISNULL(CAST(A.GECIKME_FAIZ AS FLOAT),0)+
        ISNULL(CAST(A.GECIKME_BSMV AS FLOAT),0)) AS 'YATAN',
    

    Try replacing this with:

    ISNULL(CAST(A.ODENEN_ANAPARA AS FLOAT),0)+ISNULL(CAST(A.FAIZ AS FLOAT),0)+
        ISNULL(CAST(A.BSMV AS FLOAT),0)+ISNULL(CAST(A.GECIKME_FAIZ AS FLOAT),0)+
        ISNULL(CAST(A.GECIKME_BSMV AS FLOAT),0) AS 'YATAN',
    

    Which also means you should be able to remove your GROUP BY clause. This should provide you with the results for any unique results in your tables.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not good at t-sql, so I need help. I have this code I
I'm using SQL Server 2008. I have a database table that looks like this
I am not good at SQL Server 2000. I have a comma-delimited list of
I'm not very good in SQL and HQL... I have two domains: class Hotel
Does anyone have any good sources of information of using NHibernate with Sql Azure
Good Afternoon All, I have two tables in my SQL Server 2005 DB, Main
I feel like this deserves a good comment but I get the feeling that
I am quite new at SQL statements and I have never been very good
I am working with SQL Server 2005. I need to select all rows from
I'm no good at writing MySQL queries, so this query isn't working as it

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.