当前位置:网站首页>SQL solve select basic statement
SQL solve select basic statement
2022-06-25 07:28:00 【CSDN Q & A】
The phenomenon and background of the problem
The title is as follows
From the order_items table, get the items
for order #6
where the total price is greater than 30
Problem related code , Do not paste screenshots
My code is as follows
SELECT *, quantity * unit_price AS total_price
FROM order_items
WHERE order_id=6 AND total_price > 30
Operation results and error reporting contents
Error Code: 1054. Unknown column 'total_price' in 'where clause'
My solution ideas and tried methods
The correct solution is as follows
SELECT *
FROM order_items
WHERE order_id = 6 AND total_price>30
What I want to achieve
because column There is no total price column , So I want the output to show quantity * unit_price The numerical , But it's always wrong ……
Take the answer :
Alias cannot be used in query criteria , Revised as follows :
SELECT *, quantity * unit_price AS total_priceFROM order_itemsWHERE order_id=6 AND quantity * unit_price > 30边栏推荐
- Make enough money to go back home
- lotus v1.16.0-rc3 calibnet
- How do I get red green blue (RGB) and alpha back from a UIColor object?
- 线程状态变化涉及哪些常用 API
- lotus v1.16.0-rc3 calibnet
- 活动报名|Apache Pulsar x KubeSphere 在线 Meetup 火热报名中
- Editing the date formatting of x-axis tick labels in Matplotlib - editing the date formatting of x-axis tick labels in Matplotlib
- 【工具分享】一款颜值与技能并重的软件
- 正版photoshop2022購買體驗經曆分享
- Hanxin's trick: consistent hashing
猜你喜欢

Tempest HDMI leak receive 1

从感知机到Transformer,一文概述深度学习简史

鸿蒙页面菜单的选择

Omni toolbox direct download
![[Yu Yue education] engineering testing technology reference of Wenhua University](/img/69/50a8786ea062a541df9e07c1e16db5.jpg)
[Yu Yue education] engineering testing technology reference of Wenhua University

高数基础_函数的奇偶性

In depth analysis of Apache bookkeeper series: Part 3 - reading principle

Design a MySQL table for message queue to store message data

【UVM入門 ===> Episode_9 】~ 寄存器模型、寄存器模型的集成、寄存器模型的常規方法、寄存器模型的應用場景

StreamNative Platform 1.5 版本发布,集成 Istio、支持 OpenShift 部署
随机推荐
ES can finally find brother Wukong!
Event registration | Apache pulsar x kubesphere online meetup is coming
关于硬件问题造成的MCU死机,过来人简单的谈一谈
Shell command learning
New research shows that human ability to make decisions and process information does not decline until the age of 60
Is it possible to use Jasmine's toHaveBeenCalledWith matcher with a regular expression?
[he doesn't mention love, but every word is love]
In depth analysis of Apache bookkeeper series: Part 3 - reading principle
终于等到你,小程序开源啦~
Clearing Magento log data - clearing Magento log data
Cocos learning diary 3 - API acquisition nodes and components
shell 上下两行合并成一行
Wow, it's so rich.
我与CSDN的一年时光及大学经验分享
Jameswebb Space Telescope goes into operation to help study interstellar objects
48 pictures | teach you the performance monitoring, pressure testing and tuning of microservices by hand
Ltpowercad II and ltpowerplanner III
The principle of Zener diode, what is its function?
Sqlmap advanced use – cookies
韩信大招:一致性哈希