Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Dec 2007
    Posts
    269
    Thanks
    28
    Thanked 0 Times in 0 Posts

    except for "select from"

    this is my query

    PHP Code:
    SELECT FROM cdr WHERE dst 'hangup' 
    bu i wanna except src column value ; namely SELECT * FROM cdr WHERE dst = 'hangup' except src value is starting from PSTN

    how can i create it ?
    Last edited by zodehala; 01-17-2012 at 04:55 PM.

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,497
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    I don't know what PSTN means.

    You're doing a query that will result in a certain number of rows.
    The number of rows depends on how many rows have dst='hangup'.

    But because of the asterisk (*), the resulting rows will contain all of the columns you have.

    So, if you put the query result into an array, you'll be able to see the value
    of 'src' for any of the selected rows.

    Does that make sense?
    I think there might be a language barrier here.

  • #3
    New Coder
    Join Date
    Sep 2011
    Posts
    40
    Thanks
    0
    Thanked 7 Times in 7 Posts
    Quote Originally Posted by zodehala View Post
    this is my query

    PHP Code:
    SELECT FROM cdr WHERE dst 'hangup' 
    bu i wanna except src column value ; namely SELECT * FROM cdr WHERE dst = 'hangup' except src value is starting from PSTN

    how can i create it ?


    Are you saying that you have a column named 'src', and that you only want values returned where that column isn't 'PSTN'?

    In that case, go for this:

    PHP Code:
    SELECT FROM cdr WHERE dst 'hangup' AND src != 'PSTN' 

    Or, if you want to exclude any record that ---starts--- with PSTN, go for this:

    PHP Code:
    SELECT FROM cdr WHERE dst 'hangup' AND src NOT LIKE 'PSTN%' 


  •  

    Posting Permissions

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