| |

VerySource

 Forgot password?
 Register
Search
View: 1873|Reply: 13

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

[Copy link]

2

Threads

9

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-1-3 00:00:02
| Show all posts |Read mode
create view v_all
as

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

union all

select wzlb = left (Received by labor insurance supplies units.wzdm, 2),
rkje = 0,
ckje = sum (laboratory supplies.je) + sum (laboratory supplies.je),
fsrq = Received by labor insurance units. bgyqrsj,
kcje = 0
from Labor insurance supplies, personal insurance supplies
where Labor insurance supplies for personal use. wzdm = Labor insurance supplies for personal use. wzdm and Labor insurance supplies for personal use. bgyqrsj = Labor insurance supplies for personal use. bgyqrsj

union all

select wzlb = left (wzdm, 2),
rkje = 0,
ckje = 0,
fsrq = null,
kcje = dj * sl
from inventory


Running the above code in the Query Analyzer fails to pass the query.
Server: Message 207, Level 16, State 3, Process v_all, Line 4
Column name 'je' is invalid.
Reply

Use magic Report

0

Threads

93

Posts

46.00

Credits

Newbie

Rank: 1

Credits
46.00

 China

Post time: 2020-1-3 09:33:01
| Show all posts
je material storage of materials in this column is not no
Reply

Use magic Report

0

Threads

93

Posts

46.00

Credits

Newbie

Rank: 1

Credits
46.00

 China

Post time: 2020-1-3 09:36:01
| Show all posts
Sum aggregate function
Need to group by column name ...
Reply

Use magic Report

2

Threads

9

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-1-3 09:45:01
| Show all posts
Yes ~

The structure of the table is as follows
Materials and materials storage

Field name Field type Field length Allowed blank Description
RKBM VARCHAR 20 No
RKSJ DATETIME 8 No Storage time
WZDM VARCHAR 10 No
SL FLOAT 8 No Quantity
DJ FLOAT 8 No Unit price
JE FLOAT 8 No Amount
GHFS VARCHAR 20 is the delivery method
GHDW VARCHAR 50 is the delivery unit
CZYDM VARCHAR 10 is planner code
BGYDM VARCHAR 10 is custodian code
BGYQR VARCHAR 2 Yes Depository confirmation mark
BGYQRSJ DATETIME 8 Yes
KCSL FLOAT 8 No In Stock
YRKCBZ VARCHAR 2 Yes In Stock
ZJHX VARCHAR 2 is the mark of fund write-off
HXSJ SMALLDATETIR 4 Yes Write-off time
CWQR CHAR 1 Yes Financial Confirmation Mark

Material inventory
Field name Field type Field length Allowed blank Description
WZDM VARCHAR 10 No
DJ FLOAT 8 is unit price
SL FLOAT 8 No Quantity
SJ DATETIME 8 No Time
BGYDM VARCHAR 10 is custodian code

Labor insurance supplies
Field name Field type Field length Allowed blank Description
zth VARCHAR 10 Yes Feature
SJ CHAR 10 No Time
DWMC VARCHAR 20 No Unit name
ZM VARCHAR 20 is group name
WZMC VARCHAR 40 No
WZDM VARCHAR 10 No
GGXH VARCHAAR 60 is the model
DW VARCHAAR 12 is a unit of measure
LYBZ FLOAT 8 No
RS FLOAT 8 No
ZS FLOAT 8 No Total
DJ FLOAT 8 is unit price
JE FLOAT 8 Yes Amount
BGYDM VARCHAAR 12 is custodian code
BGYQR VARCHAAR 2 Yes Depository confirmation mark
BGYQRSJ CHAR 10 Yes Depository confirmation time
LLDBH VARCHAAR 15 No Picking order number
YSCBZ CHAR 1 Yes Flag generated
QX NUMERIC 9 Yes
CWQR VARCHAAR 1 Yes Financial Confirmation


Personal insurance supplies for personal use
Field name Field type Field length Allowed blank Description
LLDBH VARCHAR 25 Yes Picking List Number
ZTH VARCHAR 10 Yes Feature
DWMC VARCHAR 14 No Unit name
XM VARCHAR 20 No Name
GZ VARCHAR 20 Yes
WZDM CHAR 10 is the material code
WZMC VARCHAR 40 Yes
GGXH VARCHAR 60 is the model number
DW VARCHAR 8 is the unit of measure
SYQX INT 4 Yes
LYSJ VARCHAR 10 Yes Pickup time
LYSL FLOAT 8 Yes Received quantity
DJ FLOAT 8 is unit price
BGYQR VARCHAR 2 Yes Depository confirmation mark
BGYQRSJ VARCHAR 12 Yes Depository confirmation time
YSCBZ VARCHAR 2 Yes Generated flag
HZBH CHAR 13 Yes
CWQR VARCHAR 1 Yes Financial confirmation
Reply

Use magic Report

0

Threads

100

Posts

53.00

Credits

Newbie

Rank: 1

Credits
53.00

 China

Post time: 2020-1-3 09:51:02
| Show all posts
Without this column.
Reply

Use magic Report

0

Threads

93

Posts

46.00

Credits

Newbie

Rank: 1

Credits
46.00

 China

Post time: 2020-1-3 09:57:01
| Show all posts
select wzlb = left (wzdm, 2),
rkje = sum (je),
ckje = 0,
fsrq = max (rksj),
kcje = 0
from materials and materials
group by left (wzdm, 2)

or
select wzlb = left (wzdm, 2),
rkje = je,-remove sum
ckje = 0,
fsrq = max (rksj),
kcje = 0
from materials and materials
Reply

Use magic Report

0

Threads

93

Posts

46.00

Credits

Newbie

Rank: 1

Credits
46.00

 China

Post time: 2020-1-3 10:06:01
| Show all posts
The landlord executed it separately to understand that that statement was wrong.
You can also paste part of the data to see
Reply

Use magic Report

0

Threads

93

Posts

46.00

Credits

Newbie

Rank: 1

Credits
46.00

 China

Post time: 2020-1-3 10:09:01
| Show all posts
select wzlb = left (Received by labor insurance supplies units.wzdm, 2),
rkje = 0,
ckje = sum (laboratory supplies.je) + sum (laboratory supplies.je),
fsrq = Received by labor insurance units. bgyqrsj,
kcje = 0
from Labor insurance supplies, personal insurance supplies
where Labor insurance supplies for personal use. wzdm = Labor insurance supplies for personal use. wzdm and Labor insurance supplies for personal use. bgyqrsj = Labor insurance supplies for personal use. bgyqrsj
group by left (wzdm, 2 for labor insurance supplies units, b.
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:18:01
| Show all posts
A report that wants to find out the amount of storage and the amount of storage out of a certain category of articles over a period of time.
fsrq = max (rksj) Why do you want to change it here?

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

Still prompted that the column name is invalid.
Reply

Use magic Report

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

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