我需要找到购买最贵产品的客户的名字和姓氏。
模式
订单
客户
Order_Contents
产品
我该如何撰写此查询?
答案 0 :(得分:1)
您可以按如下方式使用子查询。
select
Customers.customerFN,
Customers.customerLN
from
Customers
inner join Orders on Orders.customerID = Customers.customerID
inner join Order_Contents on Order_Contents.orderID = Orders.orderID
where
Order_Contents.productID in
(select Products.productID from Products where Products.unitPrice = (select max(Products.unitPrice) from Products))
答案 1 :(得分:0)
像这样的东西似乎应该作为一个跳跃点(这里完全天真的方法)
MyModelC
答案 2 :(得分:0)
my $orig = q{
1 cctataactt ggaatgtggg tggaggggtt catagttctc cctgagtgag acttgcctgc
61 ttctctggcc cctggtcctg tcctgttctc cagcatggtg tgtctgaagc tccctggagg
121 ctcctgcatg acagcgctga cagtgacact gatggtgctg agctccccac tggctttgtc
181 tggggacacc cgacgtaagt gcacattgcg ggtgctgagc tactatgggg tggggaaaat
0921 ggcctgaagt cccagcattg atggcagcgc ctcatcttca acttttgtgc tcccctttgc
10981 ctaaaccgta tggcctcccg tgcatctgta ttcaccctgt atgacaaaca cattacatta
11041 ttaaatgttt ctcaaagatg gagttaaa
};
## use this block if wish to extract each block
while ( $orig =~ /([atgc]{10})/simg )
{
print "$1\n";
}
## or this block to get single string without numbers,spaces or newlines
$orig =~ s/[\d|\W]+//smg;
## or to retain newlines
print $orig;