Jump to content

Problem arises in a SQL statement


heshan

Recommended Posts

Hi All,

 

I have a small problem related to a specific query. It creates following error.

 

Unknown column 'attendance_state.state' in 'field list'

 

    $query="SELECT attendance_state.state,attendance_state.state_id from attendance_state inner join attendance on    attendance_state.state_id=attendance.state_id where attendance.admission_no='".$admission_id[$i]."' and attendance.date='$date'";
    $result=mysql_query($query) or die (mysql_error());

 

The table related to the query looks like this. "state_id" is set as auto increment field.

 

attendance_state (state_id, state)

attendance (admission_no, state_id, date)

Link to comment
Share on other sites

That query executed successfully...Following is the result..

 

Table Create Table

attendance_state CREATE TABLE `attendance_state` (

`state_id` int(20) NOT NULL AUTO_INCREMENT,

` state` varchar(50) NOT NULL,

KEY `state_id` (`state_id`)

) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.