-1

現在使用しているテーブルが 3 つあります。

agare (owner)

===================================================================================================
| FNR   |FASTIGHETSBETECKNING|     NAMN      |  CO  |UTADR1|    UTADR2      | POSTNR    | POSTORT |
===================================================================================================
|854684 |     Berryfarm 1    | Granny Smith  | NULL | NULL | Treebranch 12  | 765 18    |  Meadow |
|135864 |     Satinfarm 1    | Sara Lovelace | NULL | NULL | Satin Hill 12  | 376 49    |  Satina |
|468952 |     Fairyhill 7    | Paula Green   | NULL | NULL |  Oaktree 12    | 468 67    |  Fairys |
|468952 |     Fairyhill 6    | Paula Green   | NULL | NULL |  Oaktree 12    | 468 67    |  Fairys |

fastighet (Estate that the owner owns)
===============================================================
| FNR  |FASTIGHETSBETECKNING|BELAGENHETSADRESS|POSTNR|POSTORT |
---------------------------------------------------------------
|854684|     Berryfarm 1    |  cherryroad 14  |759 45|Grassmow|
|135864|     Satinfarm 1    |  Satineroad 69  |136 89|Satiniqe|
|468952|     Fairyhill 7    |  fairysroad 17  |845 97|Birdsfal|
|468952|     Fairyhill 6    |  fairysroad 19  |962 63|Flowersy|
===============================================================

users (registrated user)
========================
|username|   adress    |
------------------------
| 854684 |             |
| 135864 |             |
| 468952 |fairysroad 17|
| 468952 |fairysroad 19|
========================

1 つのエステートを持つ人を見つけることができます:

SELECT FNR FROM agare,users WHERE FNR IN (SELECT FNR FROM fastighet, users WHERE FNR=username AND adress IS NULL GROUP BY FNR HAVING COUNT(FNR) < 2) AND users.username=FNR GROUP BY FNR

魔女は、住所欄が空白の多くの人々のリストを返します

しかし、users の空白のアドレス フィールドに fastighet のデータを入力したいと考えています。

使用しようとしましINSERT into users (adress) SELECT "something"たが、助けが必要です

よろしくマーティン

4

2 に答える 2