-1

私は2つのテーブルを持っています、

  1. billing ("columns"(bill_no,item_no)) // 請求番号はデータベースで繰り返すことができます
  2. items ("columns"(item_no(主キー),name,type,price)

これを表示するために可能なクエリを知りたい:

|bill_no|item_no|name|type|price|

請求テーブルの *bill_no* と *item_no* を *item_no* 列を使用してitemテーブルの n 値を表示したい

ありがとうございました。

4

3 に答える 3

0

クエリで何をしたいかに応じて、次のオプションがあります。

select billing.bill_no
, billing.item_no
, item.name
, item.type
, item.price
from billing, items
where billing.item_no = items.item_no

また

select billing.bill_no
, billing.item_no
, item.name
, item.type
, item.price
from billing
join items on billing.item_no = items.item_no
where billing.bill_no = 1234
于 2012-03-06T17:20:15.257 に答える
0

単純な結合を使用できます。

select billing.bill_no
        ,billing.item_no
        ,items.name
        ,items.type
        ,items.price
from billing
join items on items.item_no = billing.item_no
于 2012-03-06T17:21:24.263 に答える
0
Select b.bill_no
      ,i.item_no
      ,i.name
      ,i.type
      ,i.price 
 from billing b
     ,items i
 where i.item_no=b.item_no;
于 2012-03-06T17:22:12.130 に答える