I need to select static colums + a dynamic number of rows as columns in SQL
TABLE 1 ------- HotelID BlockID BlockName TABLE 2 ------- BlockDate (unknown number
you are missing a foreign key. I have to assume that BlockId should be PK in table 2?
Also, assuming that this is a legacy db and changing the structure is not an option, i have to ask which platform?
If ms sql, this could easily be achieved using a dynamic sql statement.