Yii Framework Forum: No Column Name Was Specified For Column - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

No Column Name Was Specified For Column Rate Topic: -----

#1 User is offline   yii_king 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 110
  • Joined: 05-August 12

Posted 19 March 2013 - 01:38 PM

Using the query below in MySQL and it works. However, in MSSQL it is giving me the error message: "No column name was specified for column 3 of 'mr1'." The column "col" does not exist as such but is filled in the subqueries.

Quote

SELECT YEAR(date) as year, MONTH(date) as month, sum(col) as sum FROM ( SELECT date, YEAR(date) as year, MONTH(date), hour00_01 as col FROM tbl_m as mr2 WHERE ( id = '1') AND (inputType = 'test') AND (date >= '2013-03-18' AND date <= '2013-03-22')
UNION ALL SELECT date, YEAR(date) as year, MONTH(date) as month, hour01_02 FROM tbl_m as mr3 WHERE ( id = '1') AND (inputType = 'test') AND (date >= '2013-03-18' AND date <= '2013-03-22') ) as mr1 GROUP BY MONTH(date)


Can you please help me out? What am I doing wrong here?
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users