![](/img/trans.png)
[英]SELECT random rows with a condition from 2 different table in PostgreSQL
[英]PostgreSQL selecting rows from table with specified condition
我正在使用PostgreSQL數據庫。 我有一個表course(id, c_name)
,想檢索已注冊多個課程的id
`我正在嘗試以下查詢,但是它不返回任何記錄。
SELECT id FROM sub where c_name = 'comp' and c_name = 'maths'
在這方面有幫助嗎?
select id, count(distinct c_name)
from course
group by id
having count(distinct c_name) > 1
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.