Professional Web Applications Themes

How to Rewrite Subsquery to joins - MySQL

Hi how do i rewrite this subquery with joins as subqueries won't work in linux OS "select role.role_code,role.role_name from role WHERE role_code NOT IN (select role_code from login_role WHERE LOGIN_ID=?)" Thanx Sreelu...

  1. #1

    Default How to Rewrite Subsquery to joins

    Hi
    how do i rewrite this subquery with joins as subqueries won't work in
    linux OS

    "select role.role_code,role.role_name from role WHERE role_code NOT IN
    (select role_code from login_role WHERE LOGIN_ID=?)"

    Thanx
    Sreelu

    shreelu Guest

  2. #2

    Default Re: How to Rewrite Subsquery to joins


    shreelu wrote:
     

    I'm not sure that your statement
    "subqueries won't work in linux OS" is totally true, but here is the
    query re-written as a join:

    SELECT role.role_code, role.role_name
    FROM role
    LEFT JOIN login_role ON role.role_code = login_role.role_code
    AND login_role.login_id = 'l1'
    WHERE login_role.login_id IS NULL

    Captain Guest

  3. #3

    Default Re: How to Rewrite Subsquery to joins

    shreelu wrote:
     


    That's completely false.



    --
    Brian Wakem
    Email: http://homepage.ntlworld.com/b.wakem/myemail.png
    Brian Guest

  4. #4

    Default Re: How to Rewrite Subsquery to joins

    Brian Wakem wrote: 
    >
    > That's completely false.[/ref]

    It's true if the OP's environment has a Linux host running MySQL 4.0.
    But the statement implies a causal relationship that is not true. ;-)

    Regards,
    Bill K.
    Bill Guest

  5. #5

    Default Re: How to Rewrite Subsquery to joins


    Bill Karwin wrote: 
    > >
    > > That's completely false.[/ref]
    >
    > It's true if the OP's environment has a Linux host running MySQL 4.0.[/ref]
    No it's not. As you point out subqueries WILL work in linux OS if the
    correct level of MySQL is installed. So the statement as written is
    false.
     

    Captain Guest

  6. #6

    Default Re: How to Rewrite Subsquery to joins

    Captain Paralytic wrote: 
    >>
    >>It's true if the OP's environment has a Linux host running MySQL 4.0.[/ref]
    >
    > No it's not. As you point out subqueries WILL work in linux OS if the
    > correct level of MySQL is installed. So the statement as written is
    > false.
    >

    >
    >[/ref]

    I believe Bill said:

    "It's true if the OP's environment has a Linux host running MySQL 4.0."

    This is perfectly true. Subqueries were not supported in MySQL 4.0 or
    earlier.

    --
    ==================
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    net
    ==================
    Jerry Guest

  7. #7

    Default Re: How to Rewrite Subsquery to joins

    Captain Paralytic wrote: 

    _Sigh_

    It was a joke, son.

    Regards,
    Bill K.
    Bill Guest

  8. #8

    Default Re: How to Rewrite Subsquery to joins


    Jerry Stuckle wrote: 
    > >
    > > No it's not. As you point out subqueries WILL work in linux OS if the
    > > correct level of MySQL is installed. So the statement as written is
    > > false.
    > >
    > > 
    > >
    > >[/ref]
    >
    > I believe Bill said:
    >
    > "It's true if the OP's environment has a Linux host running MySQL 4.0."
    >
    > This is perfectly true. Subqueries were not supported in MySQL 4.0 or
    > earlier.[/ref]
    No it is NOT true. The original statement is that "subqueries won't
    work in linux OS". Suppose that the OP has such a host. The same
    machine may have a separate server instance running that is running
    MySQL 5+. The statement "subqueries won't work in linux OS" is ONLY
    true if there is NO WAY to run a database on linux OS that will support
    subqueries. The statement that you quoted states a fact about a MySQL
    version, NOT about linux OS itself.

    Captain Guest

  9. #9

    Default Re: How to Rewrite Subsquery to joins

    Captain Paralytic wrote: 
    >>I believe Bill said:
    >>
    >>"It's true if the OP's environment has a Linux host running MySQL 4.0."
    >>
    >>This is perfectly true. Subqueries were not supported in MySQL 4.0 or
    >>earlier.[/ref]
    >
    > No it is NOT true. The original statement is that "subqueries won't
    > work in linux OS". Suppose that the OP has such a host. The same
    > machine may have a separate server instance running that is running
    > MySQL 5+. The statement "subqueries won't work in linux OS" is ONLY
    > true if there is NO WAY to run a database on linux OS that will support
    > subqueries. The statement that you quoted states a fact about a MySQL
    > version, NOT about linux OS itself.
    >[/ref]

    But that is not the statement you quoted and contested. Look back
    through your updates.


    --
    ==================
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    net
    ==================
    Jerry Guest

  10. #10

    Default Re: How to Rewrite Subsquery to joins


    Jerry Stuckle wrote: 
    > >
    > > No it is NOT true. The original statement is that "subqueries won't
    > > work in linux OS". Suppose that the OP has such a host. The same
    > > machine may have a separate server instance running that is running
    > > MySQL 5+. The statement "subqueries won't work in linux OS" is ONLY
    > > true if there is NO WAY to run a database on linux OS that will support
    > > subqueries. The statement that you quoted states a fact about a MySQL
    > > version, NOT about linux OS itself.
    > >[/ref]
    >
    > But that is not the statement you quoted and contested. Look back
    > through your updates.[/ref]
    I have looked back and I still don't see what you are getting at.
    Here are the statements that I quoted and contested:
     [/ref][/ref]

    Captain Guest

  11. #11

    Default Re: How to Rewrite Subsquery to joins

    Captain Paralytic wrote: [/ref]
    >
    >[/ref]

    You claimed the statement

    "It's true if the OP's environment has a Linux host running MySQL 4.0."

    is false.

    The statement is true. MySQL 4.0 does not support subqueries on any OS.

    --
    ==================
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    net
    ==================
    Jerry Guest

  12. #12

    Default Re: How to Rewrite Subsquery to joins


    Jerry Stuckle wrote: 
    > >
    > >[/ref]
    >
    > You claimed the statement
    >
    > "It's true if the OP's environment has a Linux host running MySQL 4.0."
    >
    > is false.
    >
    > The statement is true. MySQL 4.0 does not support subqueries on any OS.[/ref]
    I think you need to study English. I am certainly surprised at your low
    grasp of logic.
    The statement "subqueries won't work in linux OS" is not true. If the
    OP's environment has a Linux host running MySQL 4.0 then it is STILL
    NOT TRUE. As I ponted out (if you had bothered to read carefully), an
    instance of Linux could run more than one instance of a database
    management system. The statement "subqueries won't work in linux OS" is
    NEVER true, whilst there are versions of database systems that will
    allow the use of subqueries in linux OS. The statement "subqueries
    won't work in [any particular installation of] linux OS" MAY be true,
    but NOT the statement "subqueries won't work in linux OS".

    Captain Guest

  13. #13

    Default Re: How to Rewrite Subsquery to joins


    Jerry Stuckle wrote: 
    > >
    > >[/ref]
    >
    > You claimed the statement
    >
    > "It's true if the OP's environment has a Linux host running MySQL 4.0."
    >
    > is false.
    >
    > The statement is true. MySQL 4.0 does not support subqueries on any OS.
    >
    > --
    > ==================
    > Remove the "x" from my email address
    > Jerry Stuckle
    > JDS Computer Training Corp.
    > net
    > ==================[/ref]

    Just in case you couldn't follow my previous post.

    The statement "It's true if the OP's environment has a Linux host
    running MySQL 4.0." has as its subject the article "It's". the "It's"
    refers to the other statement in the post "subqueries won't work in
    linux OS". The statement "It's true if the OP's environment has a Linux
    host running MySQL 4.0." has no meaning stand alone (i.e. without a
    context). If the "It's" actually referered to a statement such as "The
    MySQL installed on my linux host will not run subqueries", then it
    would be true.

    However, in this case the subject is the statement "subqueries won't
    work in linux OS". Thus in this case the statement "It's true if the
    OP's environment has a Linux host running MySQL 4.0." is not true.

    Sorry if you're not happy with that, but that is how language works.
    Context is important.

    Captain Guest

  14. #14

    Default Re: How to Rewrite Subsquery to joins

    Captain Paralytic wrote: 
    >>You claimed the statement
    >>
    >>"It's true if the OP's environment has a Linux host running MySQL 4.0."
    >>
    >>is false.
    >>
    >>The statement is true. MySQL 4.0 does not support subqueries on any OS.[/ref]
    >
    > I think you need to study English. I am certainly surprised at your low
    > grasp of logic.
    > The statement "subqueries won't work in linux OS" is not true. If the
    > OP's environment has a Linux host running MySQL 4.0 then it is STILL
    > NOT TRUE. As I ponted out (if you had bothered to read carefully), an
    > instance of Linux could run more than one instance of a database
    > management system. The statement "subqueries won't work in linux OS" is
    > NEVER true, whilst there are versions of database systems that will
    > allow the use of subqueries in linux OS. The statement "subqueries
    > won't work in [any particular installation of] linux OS" MAY be true,
    > but NOT the statement "subqueries won't work in linux OS".
    >[/ref]

    And I am surprised at your lack of logic. I think YOU need to study
    English.

    The statement you replied to was:

    "It's true if the OP's environment has a Linux host running MySQL 4.0."

    You said nothing about a previous statement. If you were responding to
    the statement:

    "subqueries won't work in linux OS"

    then you should have replied to that post. The one you responded to and
    called false was correct in its entirety.

    And you call yourself a programmer? Jeez. Some people have all the
    sense of a rock.


    --
    ==================
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    net
    ==================
    Jerry Guest

  15. #15

    Default Re: How to Rewrite Subsquery to joins

    Jerry Stuckle wrote: 
    >>
    >> I think you need to study English. I am certainly surprised at your
    >> low grasp of logic.
    >> The statement "subqueries won't work in linux OS" is not true. If the
    >> OP's environment has a Linux host running MySQL 4.0 then it is STILL
    >> NOT TRUE. As I ponted out (if you had bothered to read carefully), an
    >> instance of Linux could run more than one instance of a database
    >> management system. The statement "subqueries won't work in linux OS"
    >> is NEVER true, whilst there are versions of database systems that
    >> will allow the use of subqueries in linux OS. The statement
    >> "subqueries won't work in [any particular installation of] linux OS"
    >> MAY be true, but NOT the statement "subqueries won't work in linux
    >> OS".[/ref]
    >
    > And I am surprised at your lack of logic. I think YOU need to study
    > English.
    >
    > The statement you replied to was:
    >
    > "It's true if the OP's environment has a Linux host running MySQL
    > 4.0."
    > You said nothing about a previous statement. If you were responding
    > to the statement:
    >
    > "subqueries won't work in linux OS"
    >
    > then you should have replied to that post. The one you responded to
    > and called false was correct in its entirety.[/ref]
    It was not, since the statement on its own is meaningless without an
    qualification of the subject. I was commenting on the statement which was
    made about the previous statement which was included in the quote. The
    "It's" referred to the previous statement and it is that that makes the
    final statement false. This is obviously too much for your brain to take in.
     

    No I don't need to study English. Neither do I make comments on meaningless
    statements. The statement has no meaning unless taken in context, as
    otherwise the subject "It's", is unqualified (you can ask a programmer about
    unqualified references if you don't understand them). I have explained about
    the use of the pronoun "it" in another post in this thread.


    Paul Guest

  16. #16

    Default Re: How to Rewrite Subsquery to joins

    Paul Lautman wrote: 
    >>
    >>And I am surprised at your lack of logic. I think YOU need to study
    >>English.
    >>
    >>The statement you replied to was:
    >>
    >>"It's true if the OP's environment has a Linux host running MySQL
    >>4.0."
    >>You said nothing about a previous statement. If you were responding
    >>to the statement:
    >>
    >>"subqueries won't work in linux OS"
    >>
    >>then you should have replied to that post. The one you responded to
    >>and called false was correct in its entirety.[/ref]
    >
    > It was not, since the statement on its own is meaningless without an
    > qualification of the subject. I was commenting on the statement which was
    > made about the previous statement which was included in the quote. The
    > "It's" referred to the previous statement and it is that that makes the
    > final statement false. This is obviously too much for your brain to take in.
    >

    >
    >
    > No I don't need to study English. Neither do I make comments on meaningless
    > statements. The statement has no meaning unless taken in context, as
    > otherwise the subject "It's", is unqualified (you can ask a programmer about
    > unqualified references if you don't understand them). I have explained about
    > the use of the pronoun "it" in another post in this thread.
    >
    >[/ref]

    You are totally hilarious. I showed your message and the ones to it to
    my wife - who happened to be an English major and taught English.

    She, with no technical background at all, agrees with me. Your response
    was to the immediately preceding statement - not something three
    messages back.

    Next time you want to respond to a message, respond to that message.
    Not one several layers down the thread.

    Stupid.

    And I'm done with this thread. I don't argue with idiots.

    --
    ==================
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    net
    ==================
    Jerry Guest

  17. #17

    Default Re: How to Rewrite Subsquery to joins

    Jerry Stuckle wrote: 
    >>
    >> It was not, since the statement on its own is meaningless without an
    >> qualification of the subject. I was commenting on the statement
    >> which was made about the previous statement which was included in
    >> the quote. The "It's" referred to the previous statement and it is
    >> that that makes the final statement false. This is obviously too
    >> much for your brain to take in. 
    >>
    >>
    >> No I don't need to study English. Neither do I make comments on
    >> meaningless statements. The statement has no meaning unless taken in
    >> context, as otherwise the subject "It's", is unqualified (you can
    >> ask a programmer about unqualified references if you don't
    >> understand them). I have explained about the use of the pronoun "it"
    >> in another post in this thread.[/ref]
    >
    > You are totally hilarious. I showed your message and the ones to it
    > to my wife - who happened to be an English major and taught English.
    >
    > She, with no technical background at all, agrees with me. Your
    > response was to the immediately preceding statement - not something
    > three messages back.
    >
    > Next time you want to respond to a message, respond to that message.
    > Not one several layers down the thread.
    >
    > Stupid.
    >
    > And I'm done with this thread. I don't argue with idiots.[/ref]

    And your wife agreed with you that the statement made sense on its own! I'd
    say she was the idiot!


    Paul Guest

Similar Threads

  1. #39840 [NEW]: rewrite a multidimensional array causes a bug?
    By wesborland at email dot it in forum PHP Bugs
    Replies: 1
    Last Post: December 15th, 09:32 AM
  2. JOINs instead of AND
    By Jim Michaels in forum MySQL
    Replies: 1
    Last Post: March 11th, 02:26 AM
  3. SQL help on joins
    By zCrow in forum Dreamweaver AppDev
    Replies: 3
    Last Post: May 10th, 09:17 PM
  4. HELP!!!!! need to know how to rewrite on acrobat reader
    By l33ch@adobeforums.com in forum Adobe Acrobat Windows
    Replies: 9
    Last Post: April 7th, 01:44 PM
  5. Rewrite <img> and <a> tags.
    By Simon Fredriksson in forum PHP Development
    Replies: 1
    Last Post: July 25th, 06:03 PM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139