Selecting everything from table with two innner joins and grouping by

Tags: sql-server
Question!

I'm coming here as a last resort of needed help. Basically I have a table which contains links to that have fk to another table, then that another table needs to take out info based of its fk key to another table. Not sure if it has any meaning @_ @

SQL that doesn't work but been trying to make it for hours:

SELECT episode_number,film_episodes.episode_date, fk_film_id, episode_id FROM film_episodes
                                                    INNER JOIN films ON films.film_id = film_episodes.fk_film_id
                                                    INNER JOIN fiber_link_ep ON film.episode_id = film_link_ep.fk_episode_id
                                                    WHERE film_episodes.episode_id = film_link_ep.fk_episode_id
                                                        GROUP BY episode_number, episode_date, episode_id, fk_film_id
                                                        ORDER BY film_episodes.episode_date DESC

This one tho...works but gives me doubled elements instead of just one. So lets say that I have two elements with fk_id = 2 so it shows two elements instead of grouped by only 1 element.

SELECT * FROM film_episodes    INNER JOIN films ON films.film_id = film_episodes.fk_film_id
                               INNER JOIN fiber_link_ep ON film_episodes.episode_id = film_link_ep.fk_episode_id
                               WHERE film_episodes.episode_id = film_link_ep.fk_episode_id
By : Harugawa


Answers

Use a select distinct keywork or group by the column which you want to to get your unique results instead of double!!

PS : Unable to add a comment - hence adding an answer !

By : Pat


The code you're using is setting a private property of the UIDatePicker. That's the danger of using a private property. There's no guarantee that it will work in the next OS version.

If Apple detected what you were doing they would have rejected your app.

Unless there is a public interface for doing this, you may be out of luck. (And I'm not aware of a public interface for changing the text color of a date picker.)

By : Duncan C


Nothing seems to have changed because I am able to achieve it even using Swift 3 as shown below.

import UIKit

class ViewController: UIViewController
{
    override func viewDidLoad()
    {
        super.viewDidLoad()

        let temp: UIDatePicker = UIDatePicker(frame: self.view.frame)
        temp.setValue(UIColor.purple, forKey: "textColor")

        view.addSubview(temp)
    }

    override func didReceiveMemoryWarning()
    {
        super.didReceiveMemoryWarning()
    }
}


This video can help you solving your question :)
By: admin