Jabop Posted March 16, 2008 Share Posted March 16, 2008 [pre] Images Table ID SubmissionType SubmissionID FileName Ext Uploader Default [/pre] When a user uploads the images, the info is posted into the table. Submission ID will be where the image is being displayed. My question is, how can I insert the Default record to 1 for the FIRST record inserted in the table with the SubmissionID of X. Example: I want to be able to check to see if the SubmissionID already has a record with a Default value of 1, and if not, make it 0. I've been looking at a lot of sql help online, and can't find what I need. Quote Link to comment Share on other sites More sharing options...
Jabop Posted March 16, 2008 Author Share Posted March 16, 2008 Also, right now I am just GROUPING by the SubmissionID. Here is my SQL. SELECT n.ID, n.Category, n.Title, n.Description, n.Body, n.CreatedBy, n.Time, u.UserName, i.SubmissionType, i.SubmissionID, i.FileName, i.Ext FROM news AS n LEFT JOIN users AS u ON u.ID=n.CreatedBy LEFT JOIN uploaded_images AS i ON n.ID=i.SubmissionID GROUP BY n.ID ORDER BY n.Time DESC LIMIT ".$Lim.",5" Quote Link to comment Share on other sites More sharing options...
fenway Posted March 17, 2008 Share Posted March 17, 2008 What is "first"? Always by date? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.