| |

VerySource

 Forgot password?
 Register
Search
View: 766|Reply: 5

anxious! !! Urgent !! urgent !! rookie online waiting for a simple sql

[Copy link]

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-3-19 13:30:02
| Show all posts |Read mode
select sum (DocCount) as DocCount,
MAX (convert (int, SignSendDate)) as CompleteDate from ArchiveInfos
where docID in (select DocID from DocArchiveItems where InfoID = '00000000000000000019') and sourcetype = '1'

   How to make doccount = 0 when docCount is null, and equal to the sum when it is not null
Reply

Use magic Report

0

Threads

88

Posts

55.00

Credits

Newbie

Rank: 1

Credits
55.00

 China

Post time: 2020-6-23 19:45:02
| Show all posts
select sum(isnull(DocCount,0)) as DocCount,
MAX(convert (int,SignSendDate)) as CompleteDate from ArchiveInfos
where docID in( select DocID from DocArchiveItems where InfoID='00000000000000000019') and sourcetype='1'
Reply

Use magic Report

0

Threads

88

Posts

55.00

Credits

Newbie

Rank: 1

Credits
55.00

 China

Post time: 2020-6-23 21:15:01
| Show all posts
isnull(column name, 0)
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-6-23 23:15:02
| Show all posts
I'm judging that the value of the field after sum isnull doesn't seem to work
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-6-24 10:30:01
| Show all posts
Wrongly written just now ha ha ha thank you
Reply

Use magic Report

0

Threads

93

Posts

46.00

Credits

Newbie

Rank: 1

Credits
46.00

 China

Post time: 2020-6-24 12:45:01
| Show all posts
select sum(DocCount) as DocCount
Change it
select DocCount=case when sum(DocCount)!=0 then sum(DocCount) else''end
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list