Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想编写连接两个表并返回结果的 sql 查询。假设我们有两个域类:
class Patient { static hasMany = [visits: Visit] String firstName }
和
class Visit { static belongsTo = [patient: Patient] String visitNo }
现在,我如何使用 sql 连接这两个表?
用于grails schema-export将表 DDL 写入target/ddl.sql- 它将向您显示表结构、外键等。
grails schema-export
target/ddl.sql
在这种情况下,它会像
select p.first_name, v.visit_no from patient p join visit v on v.patient_id=p.id