GET 24/7 LIVE HELP NOW

Announcement

Announcement Module
Collapse
No announcement yet.

MySQL functions

Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MySQL functions

    who can bail me out with a code hat produces a result to the following question?

    Return a list of all flights along with their current un-discounted price

    according to these tables;

    CREATE TABLE `fly-four-less`.`flight_profiles` (
    `FLP_ID` decimal(8,0) NOT NULL default '0',
    `FLT_NUMB` decimal(4,0) default NULL,
    `SEATS` int(11) default NULL,
    `PRICE_CODE` varchar(50) default NULL,
    `from` varchar(50) default NULL,
    `to` varchar(50) default NULL,
    `MON` varchar(1) default NULL,
    `TUE` varchar(1) default NULL,
    `NEXT_DAY` int(11) default NULL,
    `WED` varchar(1) default NULL,
    `THU` varchar(1) default NULL,
    `FRI` varchar(1) default NULL,
    `SAT` varchar(1) default NULL,
    `SUN` varchar(1) default NULL,
    `depart` datetime default NULL,
    `arrive` datetime default NULL,
    PRIMARY KEY (`FLP_ID`),
    UNIQUE KEY `FLT_NUMB` (`FLT_NUMB`),
    KEY `FK_flight_profiles_1` (`from`),
    KEY `FK_flight_profiles_2` (`to`),
    CONSTRAINT `flight_profiles_ibfk_1` FOREIGN KEY (`from`) REFERENCES `airports` (`IATA_CODE`),
    CONSTRAINT `flight_profiles_ibfk_2` FOREIGN KEY (`to`) REFERENCES `airports` (`IATA_CODE`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

    CREATE TABLE `fly-four-less`.`price` (
    `PC_ID` int(11) NOT NULL default '0',
    `PC_LEVEL` int(11) default NULL,
    `PRICE` int(11) default NULL,
    `FROM_DATE` datetime default NULL,
    `TO_DATE` datetime default NULL,
    PRIMARY KEY (`PC_ID`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

    CREATE TABLE `fly-four-less`.`discount` (
    `DIS_ID` int(11) NOT NULL default '0',
    `DAYS_ADV_MIN` int(11) default NULL,
    `DAYS_ADV_MAX` int(11) default NULL,
    `PASSENGER_TYPE` int(11) default NULL,
    `DISCOUNT` int(11) default NULL,
    PRIMARY KEY (`DIS_ID`),
    KEY `FK_discount_1` (`PASSENGER_TYPE`),
    CONSTRAINT `discount_ibfk_1` FOREIGN KEY (`PASSENGER_TYPE`) REFERENCES `person_type` (`PT_ID`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

    i came up with the following lines of query, but its not the results, if help avails can i have a deeper explanation on how the query digs to the table(s)?

    SELECT * FROM FLIGHT_PROFILES F
    WHERE F.NEXT_DAY=0;

    Aloys

  • #2
    You need to use a JOIN.

    Comment

    Working...
    X