Results 1 to 11 of 11

Thread: tricky - i think (SQL Statement)

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539

    tricky - i think (SQL Statement)

    here is what am trying to do
    i wanna verifty that users 1 - 10 have SAME firstname
    so if user 1 and user 7 have "Doink" as firstname
    i wanna verify that all others have same name

    my question is
    is there a way to do this in a easy way?
    other than 10^9 combinations?

  2. #2
    Jethro
    Guest
    Not sure if l got that. You want to check a text field in the first ten records of a database is of equal value ?

    Code:
    rs.movefirst
    sName = rs!FirstName
    rs.movenext
    '
    for x = 0 to 8
       if rs!Firstname <> sName then
              MsgBox "I'm a big Kaftan wearing Blouse"
              Exit For
       end if
       rs.moveNext
       if rs.eof then exit for
    Next x
    Am thinking this is a bit more complex than first appears kovan. Could you elaborate a wee bit more.

  3. #3
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 2000
    Location
    off others' brains
    Posts
    4,345

    Well ...

    I, too, would like to solve it/see the solution. Can you please provide more details, Kovan ?

    .
    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

  4. #4
    Fanatic Member Gaffer's Avatar
    Join Date
    Nov 2000
    Location
    London
    Posts
    828
    For the price of a ride in your motor, i offer this:

    select distinct [first name], [id] from MyTable
    where [first name] In (select [first name] from [MyTable] As Tmp broup by [first name] having Count(*)>1 )

    will return a list of ids of the perople who have matching first names...

  5. #5
    Jethro
    Guest
    Originally posted by Gaffer
    For the price of a ride in your motor, i offer this:

    select distinct [first name], [id] from MyTable
    where [first name] In (select [first name] from [MyTable] As Tmp broup by [first name] having Count(*)>1 )

    will return a list of ids of the perople who have matching first names...
    Nice...................is that your mother in the avatar

    Kind of thought he wanted to grab the first ten records of a table and compare names....maybe wrong

    And for something completed different this is how we would do it in revelation

    Code:
    SSelect 10 Customer by Create_Date
    Actually just trying to get gaffa to show me how to do it with an SQL statement

  6. #6
    Addicted Member stevess's Avatar
    Join Date
    May 2001
    Posts
    251
    Nice...................is that your mother in the avatar

    Kind of thought he wanted to grab the first ten records of a table and compare names....maybe wrong
    Are you bald and jealous Jethro, or just old and disapproving?

    If that's what you thought he wanted, then what was your first reply supposed to do? All your code did was see if the first name was repeated.

  7. #7
    Jethro
    Guest
    Originally posted by stevess


    Are you bald and jealous Jethro, or just old and disapproving?

    If that's what you thought he wanted, then what was your first reply supposed to do? All your code did was see if the first name was repeated.
    Clearly you don't do a lot of coding Steve, if you read his posting rather than rushing to make your own posts you will note he wants to read the first 10 records to see if the FirstName is the same.

    Now admittedly the code is off the top of my head, but was pointing out how you could do it, and then was inquirying on more details. Kovan is pretty good at this sort of thing, so presume he posted in the middle of his vb exam study and missed out a few details.

  8. #8
    Addicted Member stevess's Avatar
    Join Date
    May 2001
    Posts
    251
    [QUOTE]
    so if user 1 and user 7 have "Doink" as firstname
    i wanna verify that all others have same name
    [/QOUTE]

    [QUOTE]
    if you read his posting rather than rushing to make your own posts you will note he wants to read the first 10 records to see if the FirstName is the same.
    [QUOTE]

    Who's the one misreading?

    What if there are 4 records with the same first name?
    Don't get defensive just because someone questions you.

  9. #9
    Jethro
    Guest
    I really think you need to investigate an anger management program there Steve.

    A few points

    1. Kovan is explicitly trying to determine if the same first name in the first 10 records.

    2. As stated code off the top of my head.

    3. There are one hell of a lot of ppl on this forum who could run rings around me when it comes to cutting code.

    4. Kovan was offering an example of the situation he was testing for.

    I would suggest you apply yourself to actually helping some one, rather than coming across with having an attitude.

  10. #10
    Fanatic Member Gaffer's Avatar
    Join Date
    Nov 2000
    Location
    London
    Posts
    828
    Ladies ladies ladies. Enough already.

    The solution is for Kovan to respond and expand on this issue. I like a bit of bitchslappin', but can we keep it to Chit Chat?

  11. #11
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 2000
    Location
    off others' brains
    Posts
    4,345

    Well ...

    Was just going to suggest that, but stopped for the fear of starting another row.

    Kovan, can you please elaborate?

    .
    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

Posting Permissions

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



Click Here to Expand Forum to Full Width