Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8528181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:44:43+00:00 2026-06-11T08:44:43+00:00

I have two working MySQL views: First view selects all rows from table portfolio

  • 0

I have two working MySQL views:

First view selects all rows from table portfolio which id’s are in table mural as well.

CREATE 
    ALGORITHM = UNDEFINED 
    DEFINER = `root`@`localhost` 
    SQL SECURITY DEFINER
VIEW `view_mural` AS
    select 
        `portfolio`.`id`                    AS `id`,
        `portfolio`.`customer_id`           AS `customer_id`,
        `portfolio`.`location_id`           AS `location_id`,
        `portfolio`.`title_text_id`         AS `title_text_id`,
        `portfolio`.`description_text_id`   AS `description_text_id`,
        `portfolio`.`started`               AS `started`,
        `portfolio`.`finished`              AS `finished`,
    from
        `portfolio`
    where
        `portfolio`.`id` in (select 
                `mural`.`portfolio_id`
            from
                `mural`) WITH CASCADED CHECK OPTION

Second view selects rows from two tables: portfolio and mural.

CREATE 
    ALGORITHM = UNDEFINED 
    DEFINER = `root`@`localhost` 
    SQL SECURITY DEFINER
VIEW `view_mural` AS
    select 
        `portfolio`.`id`                                AS `id`,
        `portfolio`.`customer_id`                       AS `customer_id`,
        `portfolio`.`location_id`                       AS `location_id`,
        `portfolio`.`title_text_id`                     AS `title_text_id`,
        `portfolio`.`description_text_id`               AS `description_text_id`,
        `portfolio`.`started`                           AS `started`,
        `portfolio`.`finished`                          AS `finished`,
        (select 
            `mural`.`width` 
        from 
            `mural` 
        where 
            `mural`.`portfolio_id`=`portfolio`.`id`)    AS `mup`
    from
        `portfolio`

I can’t get, how to combine these into one view, to select table, with columns from both tables, which contains rows from table portfolio which id’s are in table mural as well.

When I add:

    where
        `portfolio`.`id` in (select 
                `mural`.`portfolio_id`
            from
                `mural`) WITH CASCADED CHECK OPTION

to the very end of my second view it shows me an error:

Apply changes to view_mural Error 1368: CHECK OPTION on non-updatable view 'view_mural' SQL Statement:  CREATE       OR REPLACE ALGORITHM = UNDEFINED      DEFINER = `root`@`localhost`      SQL SECURITY DEFINER VIEW `view_mural` AS     select          `portfolio`.`id` AS `id`,         `portfolio`.`customer_id` AS `customer_id`,         `portfolio`.`location_id` AS `location_id`,         `portfolio`.`title_text_id` AS `title_text_id`,         `portfolio`.`description_text_id` AS `description_text_id`,         `portfolio`.`started` AS `started`,         `portfolio`.`finished` AS `finished`,         (select `mural`.`width` from `mural` where `mural`.`portfolio_id`=`portfolio`.`id`) AS `mup`     from         `portfolio`     where         `portfolio`.`id` in (select                  `mural`.`portfolio_id`             from                 `mural`) WITH CASCADED CHECK OPTION  Error when running failback script. Details follow. Error 1050: Table 'view_mural' already exists SQL Statement: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_mural` AS select `portfolio`.`id` AS `id`,`portfolio`.`customer_id` AS `customer_id`,`portfolio`.`location_id` AS `location_id`,`portfolio`.`title_text_id` AS `title_text_id`,`portfolio`.`description_text_id` AS `description_text_id`,`portfolio`.`started` AS `started`,`portfolio`.`finished` AS `finished`,(select `mural`.`width` from `mural` where ((`mural`.`portfolio_id` = `portfolio`.`id`) and `portfolio`.`id` in (select `mural`.`portfolio_id` from `mural`))) AS `mup` from `portfolio`      

Could someone point me how can I do that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T08:44:44+00:00Added an answer on June 11, 2026 at 8:44 am

    Learn about SQL joins:

    SELECT
        portfolio.id,
        portfolio.customer_id,
        portfolio.location_id,
        portfolio.title_text_id,
        portfolio.description_text_id,
        portfolio.started,
        portfolio.finished,
        mural.width
    FROM
        portfolio JOIN mural ON mural.portfolio_id = portfolio.id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two views each of which contain two subviews. Hit detection is working
I have a mysql db with two tables. The first table is called 'uniqueReferences'
I am working on a filter functionality using ajax/jquery and php/mysql.I have two sets
I am working on PHP and database MySQL. I have two tables in SQL
using mysql and php, I have two tables, I'm french so the table names
I have two dropdowns in html. Both dropdowns are getting data mysql first dropdown
I'm working on mysql and have two tables with the same schema: preTrial |id|accusedId|articleid|
I am working with MySQL version 5. I have two tables structured as shown
I have two mysql servers, both of which are masters. After some problems with
I have two arrays. Each is being pulled from MySQL via the following; $query

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.