Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2012
    Posts
    2

    Unanswered: Question about database issue

    I am trying to write a single query that will look for the the specific student and professor and class and course id as well as the semid and year and change his grade from a F to a D-. Below is what I have however it gives me the error unknown column profid in where clause any help would be greatly appreciated.

    update tblenroll
    set enrollgrade ='D-'
    where
    stuid =(select stuid from tblstudents where stulname ='Oneil' and stufname ='Mohammad')
    and
    profid=(select profid from tblprofessor where proffname='Mark' and proflname='Shepard')
    and
    tblenroll.offid =(select o.offid from tblofferings o, tblCourses c, tblsem s
    where o.courseid =c.courseid
    and c.coursename='TEC375'
    and o.semid=s.semid
    and s.semquarter='Summer'
    and s.semyear = '2014');

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    please run this query --
    Code:
    SHOW CREATE TABLE tblenroll
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Mar 2012
    Posts
    2
    This is what I get when I run that
    +-----------+-------------------------------------------------------------------
    --------------------------------------------------------------------------------
    ----------------------------------------------------------------------+
    | Table | Create Table

    |
    +-----------+-------------------------------------------------------------------
    --------------------------------------------------------------------------------
    ----------------------------------------------------------------------+
    | tblenroll | CREATE TABLE `tblenroll` (
    `stuID` int(3) DEFAULT NULL,
    `offID` int(3) DEFAULT NULL,
    `enrollGrade` varchar(2) DEFAULT NULL,
    KEY `offID` (`offID`),
    KEY `stuID` (`stuID`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 |
    +-----------+-------------------------------------------------------------------
    --------------------------------------------------------------------------------
    ----------------------------------------------------------------------+
    Quote Originally Posted by r937 View Post
    please run this query --
    Code:
    SHOW CREATE TABLE tblenroll

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    well, that explains your "unknown column profid" error message

    you can't update that table where profid equals anything, because that table doesn't have a profid column

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •