...

View Full Version : except for "select from"



zodehala
01-17-2012, 05:51 PM
this is my query


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 ?

mlseim
01-17-2012, 06:19 PM
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.

themousemaster
01-17-2012, 09:33 PM
this is my query


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:


SELECT * FROM cdr WHERE dst = 'hangup' AND src != 'PSTN'


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


SELECT * FROM cdr WHERE dst = 'hangup' AND src NOT LIKE 'PSTN%'



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum