Results 1 to 5 of 5

Thread: mysql views and many queries(select) do the same job ?

  1. #1
    Join Date
    Oct 2004
    Posts
    425
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default mysql views and many queries(select) do the same job ?

    mysql views and many queries(select) do the same job ?
    May reference fields from 2 or more mysql queries(select) same time using two

    $row = mysql_fetch_row($result);
    $row1 = mysql_fetch_row($result1);
    $x = $row[1];
    $x1 = $row1[1];
    ??????

  2. #2
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    1,734
    Thanks
    82
    Thanked 90 Times in 88 Posts

    Default

    Your code makes sense, but I don't think many people know exactly what you are asking. Could you elaborate more?

  3. #3
    Join Date
    Oct 2004
    Posts
    425
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default I mean rather than using "mysql views" I can use two SELECT queries ?

    I mean rather than using "mysql views" I can use two SELECT queries ? It;s the same ?

  4. #4
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    1,734
    Thanks
    82
    Thanked 90 Times in 88 Posts

    Default

    Sorry, but that is actually less clear and more vague than your first post. The more I go over your post the more sure I am that I don't know what you are asking. Do you want to search multiple tables, columns at the same time? do you want to concatenate? Do you want to combine the results of two queries? We need a lot more information. Examples would also help. It does not have to be code, but code helps too.

  5. #5
    Join Date
    Oct 2004
    Posts
    425
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default

    I mean rather than using "mysql views" to join two SELECT queries(two tables) using common fields PK=FK ,

    CREATE VIEW Name_View (alias names _ same in number as fields of view_comma separated) AS
    SELECT TABLENAME1.FIELD1, TABLENAME1.FIELD3, TABLENAME1.FIELD5, TABLENAME2.FIELD1, TABLENAME2.FIELD6, TABLENAME2.FIELD7
    FROM TABLENAME1, TABLENAME2
    WHERE TABLENAME1.FIELD1 = TABLENAME2.FIELD1;

    I can use two SELECT queries SEPARATE and mixed refer to the fields of the two queries ? It's the same ?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •