我想合并以下代码。尽管我不知道如何引用列表结尾的任何表中的SELECT*。

        $this->displaylistings=mysql_query("SELECT * FROM nordstromlisting WHERE ShopperID = '$this->ShopperID'
    UNION ALL SELECT * FROM saksfifthavenuelisting WHERE ShopperID = '$this->ShopperID'
    UNION ALL SELECT * FROM guesslisting WHERE ShopperID = '$this->ShopperID'
    UNION ALL SELECT * FROM gnclisting WHERE ShopperID = '$this->ShopperID'
    UNION ALL SELECT * FROM urbanoutfitterslisting WHERE ShopperID = '$tnis->ShopperID'
    UNION ALL SELECT * FROM bananarepubliclisting WHERE ShopperID = '$this->ShopperID'
    UNION ALL SELECT * FROM americaneaglelisting WHERE ShopperID = '$this->ShopperID'
    UNION ALL SELECT * FROM neimanmarcuslisting WHERE ShopperID = '$this->ShopperID'
    UNION ALL SELECT * FROM footlockerlisting WHERE ShopperID = '$this->ShopperID'");

提前感谢:D

最佳答案

据我所知,没有一种方法可以引用带有通配符的表。
您可能需要考虑更改模式,以便有一个带列的listing表来指示它是什么类型的列表(saksfifthavenue,guess,…)。
然后,您可以简单地查询单个表。
这也会让你的模式好一点。

10-08 08:17