-3

2 つのテーブルがあります。

1. information

title    body     name   

title1   body1   author1   
title2   body2   author1    
title1   body1  author2 
title1   body1   author3

2. interactions

name      favorited    user_favorited_by

author1      yes          user1 
author2      yes          user1 
author1      yes          user2 
author1      no          user3

問題は、各ユーザーにとってお気に入りの著者は誰ですか?

クエリは、例に基づいて次の回答を提供する必要があります。

user1    author1
user1    author2
user2    author1

どんな助けでも感謝します。

4

3 に答える 3

0

提案してもいいですか:

select user_favorited_by, author from information a
inner join interaction b on a.name = b.name 
where b.favorited = 'yes'
于 2013-06-12T15:35:45.250 に答える