| |

VerySource

 Forgot password?
 Register
Search
Author: loverabbit

Please help me see what went wrong? Message 207, Level 16, State 3, Invalid column name 'je'

[Copy link]

0

Threads

93

Posts

46.00

Credits

Newbie

Rank: 1

Credits
46.00

 China

Post time: 2020-1-3 10:21:01
| Show all posts
Run separately and see if there is an error, not necessarily this statement
Reply

Use magic Report

2

Threads

9

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-1-3 10:24:01
| Show all posts
Change to
create view v_all
as

select wzlb = left (wzdm, 2),
rkje = sum (je),
ckje = 0,
fsrq = rksj,
kcje = 0
from materials and materials
group by left (wzdm, 2), rksj

If you execute the above code alone, there is no problem.
Reply

Use magic Report

0

Threads

93

Posts

46.00

Credits

Newbie

Rank: 1

Credits
46.00

 China

Post time: 2020-1-3 10:33:02
| Show all posts
RKSJ DATETIME 8 No Storage time
DATETIME used this column grouping, sum still makes sense ???
If the column is (2006-01-01 11:25:00 120), it doesn't make sense.
Reply

Use magic Report

2

Threads

9

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-1-3 10:51:01
| Show all posts
Material code is AABBCCDDDD
The first sentence wzlb = left (wzdm, 2) is the largest class of materials AA, and the finest classification code AABBCCDDDD is stored in wzdm.
If you use datetime grouping, isn't the sum of all the major types of supplies the day after sum?

If group by removes rksj, the error message after execution is
Server: Msg 8120, Level 16, State 1, Line 1
The column 'Material material in storage.rksj' is invalid in the select list because it is neither included in the aggregation function nor in the GROUP BY clause.

If you don't group by rksj, do you use having?
Reply

Use magic Report

2

Threads

9

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-1-3 11:00:02
| Show all posts
Tried with max (rksj) and the results came out
create view v_all
as

select wzlb = left (wzdm, 2),
rkje = sum (je),
ckje = 0,
fsrq = max (rksj),
kcje = 0
from materials and materials
group by left (wzdm, 2)

There is no problem with this paragraph. Continue to try the next paragraph. Thank you so much.
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