I have the following sql:
SELECT courseModuleCodeFROM coursesWHERE courseCodelike'%' + @.prefixText +'%'
UNION
SELECTcourseNameFROM coursesWHEREcourseNamelike'%' + @.prefixText +'%'
UNION
SELECTTeacherNameFROM coursesWHERETeacherNamelike'%' + @.prefixText +'%'
it returns one column, i want to name tha column as "words"
how do i do it?
thanks
SELECT courseModuleCode as 'words' ... and do the rest of the statement the same.
|||
PS:
How many records will your statement return if the following records are in your database:
Here's a real course from a local university.CourseModuleCodeCourseName
PHYS 212 Heat
TeacherName
Heat
Would the number of records change if you used a UNION ALL instead of a UNION? Why?
|||thanks, my brain has not been working today!
check this:
http://www.fmsinc.com/FRee/NewTips/SQL/SQLtip5.asp
No comments:
Post a Comment