select A.* from A join B on A.F_id=B.F_id where B.amount5;
專注于為中小企業提供網站制作、成都做網站服務,電腦端+手機端+微信端的三站合一,更高效的管理,為中小企業洪湖免費做網站提供優質的服務。我們立足成都,凝聚了一批互聯網行業人才,有力地推動了1000+企業的穩健成長,幫助中小企業通過網站建設實現規模擴充和轉變。
后面的判斷條件根據你自己的表來寫。
--books表中有字段有bId,pId等字段。
--another有bId,pId等字段(create table another select bId,pid,bAuthor from books;--相關字段以及內容來自books表)。
--books和publising建立外鍵,參照publishing中的id字段。
alter table books add constraint FK_books_publishing foreign key (pid) references publishing (id) on update cascade;
--another和publishing之間創建外鍵,參照publishing中的id字段。
alter table another add constraint FK_another_publishing foreign key (pId) references publishing (id) on update cascade;
--舉個簡單的更新列子:
update publishing set id = 17,pname = '愛好者' where id='14';
--當執行這條語句時(更新publishing表),books表和another表同時進行更新。
--主表更新字段數據等,副表也隨之更新,從上面可以看出,主表是publishing,副表是books和another。
--希望能幫到你
select a.name, max(b.log_time) from 表1 as a, 表2 as b where a.id = b.user_id group by a.name 根據您最新的需求,SQL修改如下,保證查詢效率沒的說: select a.id, a.name, max(b.log_time), ( select c.content from 表2 as c where c.us..