我一直在将一些MySQL查询迁移到PostgreSQL以使用Heroku.我的大多数查询工作正常,但当我使用group by时,我仍然遇到类似的重复错误:
错误:列"XYZ"必须出现在GROUP BY子句中或用于聚合函数
有人能告诉我我做错了什么吗?
MySQL 100%工作:
SELECT `availables`.*
FROM `availables`
INNER JOIN `rooms` ON `rooms`.id = `availables`.room_id
WHERE (rooms.hotel_id = 5056 AND availables.bookdate BETWEEN '2009-11-22' AND '2009-11-24')
GROUP BY availables.bookdate
ORDER BY availables.updated_at
Run Code Online (Sandbox Code Playgroud)
PostgreSQL错误:
ActiveRecord :: StatementInvalid:PGError:错误:列"availables.id"必须出现在GROUP BY子句中或用于聚合函数:
SELECT"availables".*FROM"availables"INNER JOIN"rooms"ON"rooms". id ="availables".room_id WHERE(rooms.hotel_id = 5056 AND availables.bookdate BETWEEN E'2009-10-21'EN'E'2009-10-23')GROUP BY availables.bookdate ORDER BY availables.updated_at
生成SQL的Ruby代码:
expiration = Available.find(:all,
:joins => [ :room ],
:conditions => [ "rooms.hotel_id = ? AND availables.bookdate BETWEEN ? AND ?", hostel_id, date.to_s, (date+days-1).to_s ], …Run Code Online (Sandbox Code Playgroud) 标题说明了一切.
我知道我能做到这一点:
DB::table('items')->where('something', 'value')->get()
Run Code Online (Sandbox Code Playgroud)
但我想检查多个值的where条件,如下所示:
DB::table('items')->where('something', 'array_of_value')->get()
Run Code Online (Sandbox Code Playgroud)
有这么简单的方法吗?
在Android Studio中的类中键入SQLite语句作为字符串文字时,IDE会向我发出以下警告:"<expr> expected, got '?'".
我不明白这意味着什么,但代码工作正常,我想禁用检查.但我不知道哪个检查导致它.其中有数千种,并且搜索或预期产量没有有用的结果.
Android Studio的版本是3.0.它发生在一堆不同的语句中,但典型的一个看起来像这样:
SQLiteStatement st = db.compileStatement(
"INSERT OR REPLACE INTO routes(route_code, route_desc) VALUES(?,?)"
);
Run Code Online (Sandbox Code Playgroud) 我正在用C#编写一个只使用一个表单的Windows窗体应用程序.当我想退出并关闭应用程序时,我添加了代码
private void Defeat()
{
MessageBox.Show("Goodbye");
this.Close();
}
Run Code Online (Sandbox Code Playgroud)
到类Form1 : Form,它是由Visual Studio自动创建的表单类.但是当这段代码运行时,我收到以下消息:
System.Drawing.dll中发生未处理的"System.Runtime.InteropServices.ExternalException"类型异常
附加信息:GDI +中发生一般错误.
消息图片:

问题是什么?
我该如何退出申请表?
我正在使用 angular 4、firebase 和 angular bootstrap。我打开模态,这是一个用户表单,想法是在用户使用其中一种登录方法(google auth、facebook auth 或电子邮件和密码身份验证)登录后立即关闭模态。但是我找不到在需要时关闭模态的方法。
谷歌认证
export class NavComponent implements OnInit {
@ViewChild('close') public modal: ElementRef;
constructor() {}
public openModal(content) {
this.modalService.open(content).result.then((result) => {
this.closeResult = `Closed with: ${result}`;
}, (reason) => {
this.closeResult = `Dismissed ${this.getDismissReason(reason)}`;
});
}
private getDismissReason(reason: any): string {
if (reason === ModalDismissReasons.ESC) {
return 'by pressing ESC';
} else if (reason === ModalDismissReasons.BACKDROP_CLICK) {
return 'by clicking on a backdrop';
} else {
return `with: ${reason}`;
}
}
public googleLogin(content): …Run Code Online (Sandbox Code Playgroud) 我有这样的HTML结构:
<svg>
<path/>
</svg>
<img/>
Run Code Online (Sandbox Code Playgroud)
有没有办法做"display:block;"之类的事情.到<img />时<path />悬停,仅限CSS?
我创建了一个拥有自己的自定义组件@input(),@output依此类推。该组件具有一个<input />字段,用户可以在其中输入一些值。
例如: <my-component ...></my-component>
我在我的html中引用了它,它可以完美地工作。我还创建了几个指令,这些指令可通过简单的正则表达式验证表单输入数据。我可以在格式如下的普通输入中使用它们:
<input type="text" validator1 validator2 validator3 />
有没有一种方法可以将这些指令中的一个或多个(但也没有一个)传递给我的自定义组件,而无需在组件源中对其进行硬编码?
某种...params评估?
预先感谢您的所有帮助
瓦列里奥
当我想知道哪个更快时,我正在创建和翻译一些算法。
A)(int)float
或者
b)Mathf.FloorToInt(float)
提前致谢。
编辑:如果有比这两种方法更快的方法,那也会有帮助。
uml设计器插件安装不起作用.在我选择要安装的uml设计器项之后,Eclipse"无法执行操作".安装导致错误,无法从链接中找到请求项.该链接是主页上的更新站点链接.就像下载链接会被破坏......有什么建议吗?
错误详情:
无法完成安装,因为找不到一个或多个必需的项目.
正在安装的软件:具有产品特定品牌的UML Designer 8.0.0.201709181143(org.obeonetwork.dsl.uml2.runtime.product.feature.feature.group 8.0.0.201709181143)
缺少要求:具有产品特定品牌的UML Designer 8.0.0.201709181143(org.obeonetwork.dsl.uml2.runtime.product.feature.feature.group 8.0.0.201709181143)需要'org.eclipse.sirius.runtime.acceleo.feature.group 0.0 .0'但无法找到
import cv2
import numpy as np
faceDetect=cv2.CascadeClassifier('haarcascade_frontalface_default.xml');
cam=cv2.VideoCapture(0);
rec=cv2.face.LBPHFaceRecognizer_create();
rec.load("recognizerr\\trainingData.yml")
id=0
fontface=cv2.FONT_HERSHEY_SIMPLEX
while(True):
ret,img=cam.read();
gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
faces=faceDetect.detectMultiScale(gray,1.3,5);
for(x,y,w,h) in faces:
cv2.rectangle(img,(x,y),(x+w,y+h),(0,255,0),2)
id,conf=rec.predict(gray[y:y+h,x:x+w])
if(id==1):
id="Name"
else:
id="Unknown"
cv2.putText(img,str(id),(x,y+h),fontface,2,(255,0,0),3);
cv2.imshow("Face",img);
if(cv2.waitKey(1)==ord('q')):
break;
cam.release()
cv2.destroyAllWindows()
Run Code Online (Sandbox Code Playgroud)
面对rec.load Traceback中的错误(最近一次调用最后一次):
文件"C:\ Users\DELL PC\Downloads\faceDetec_YOUTUBE-20171021T212250Z-001\recognition\detector.py",第7行,在rec.load("recognizerr\trainingData.yml")中AttributeError:'cv2.face_LBPHFaceRecognizer'对象有没有属性'load'
angular ×2
c# ×2
android ×1
css ×1
heroku ×1
int ×1
javascript ×1
laravel ×1
laravel-4 ×1
laravel-5 ×1
load ×1
mysql ×1
performance ×1
php ×1
postgresql ×1
predict ×1
python ×1
sql ×1
uml-designer ×1
where ×1