Skip to main content
deleted 25 characters in body
Source Link

I need to verify that the number that I will insert into table tbl_database is not in tables tbl_blacklist and tbl_cmdatabase

Perhaps you can do this with something like

selectSELECT count(*)
from tbl_blacklist,FROM tbl_cmdatabase(
where '$number' in (selectSELECT number fromFROM tbl_blacklist
             UNION
  SELECT number FROM tbl_cmdatabase ) unionAS selectQ
where Q.number from= tbl_cmdatabase)'$number'

When the count returned is 0, it means that $number is not in the tables. It's possible this is not the best query for this job, but it's the first thing I could think ofit will work OK.

You can play around with it here:

http://sqlfiddle.com/#!2/7d697/16/0http://sqlfiddle.com/#!2/7d697/23

I need to verify that the number that I will insert into table tbl_database is not in tables tbl_blacklist and tbl_cmdatabase

Perhaps you can do this with something like

select count(*)
from tbl_blacklist, tbl_cmdatabase
where '$number' in (select number from tbl_blacklist
                    union select number from tbl_cmdatabase)

When the count returned is 0, it means that $number is not in the tables. It's possible this is not the best query for this job, but it's the first thing I could think of.

You can play around with it here:

http://sqlfiddle.com/#!2/7d697/16/0

I need to verify that the number that I will insert into table tbl_database is not in tables tbl_blacklist and tbl_cmdatabase

Perhaps you can do this with something like

SELECT count(*)
FROM (
  SELECT number FROM tbl_blacklist
  UNION
  SELECT number FROM tbl_cmdatabase ) AS Q
where Q.number = '$number'

When the count returned is 0, it means that $number is not in the tables. It's possible this is not the best query for this job, but I think it will work OK.

You can play around with it here:

http://sqlfiddle.com/#!2/7d697/23

added 135 characters in body
Source Link

I need to verify that the number that I will insert into table tbl_database is not in tables tbl_blacklist and tbl_cmdatabase

Perhaps you can do this with something like

select count(*)
from tbl_blacklist, tbl_cmdatabase
where '$number' in (select number from tbl_blacklist
                    union select number from tbl_cmdatabase)

When the count returned is 0, it means that $number is not in the tables. It's possible this is not the best query for this job, but it's the first thing I could think of.

You can play around with it here:

http://sqlfiddle.com/#!2/7d697/16/0

I need to verify that the number that I will insert into table tbl_database is not in tables tbl_blacklist and tbl_cmdatabase

Perhaps you can do this with something like

select count(*)
from tbl_blacklist, tbl_cmdatabase
where '$number' in (select number from tbl_blacklist
                    union select number from tbl_cmdatabase)

When the count returned is 0, it means that $number is not in the tables.

http://sqlfiddle.com/#!2/7d697/16/0

I need to verify that the number that I will insert into table tbl_database is not in tables tbl_blacklist and tbl_cmdatabase

Perhaps you can do this with something like

select count(*)
from tbl_blacklist, tbl_cmdatabase
where '$number' in (select number from tbl_blacklist
                    union select number from tbl_cmdatabase)

When the count returned is 0, it means that $number is not in the tables. It's possible this is not the best query for this job, but it's the first thing I could think of.

You can play around with it here:

http://sqlfiddle.com/#!2/7d697/16/0

Source Link

I need to verify that the number that I will insert into table tbl_database is not in tables tbl_blacklist and tbl_cmdatabase

Perhaps you can do this with something like

select count(*)
from tbl_blacklist, tbl_cmdatabase
where '$number' in (select number from tbl_blacklist
                    union select number from tbl_cmdatabase)

When the count returned is 0, it means that $number is not in the tables.

http://sqlfiddle.com/#!2/7d697/16/0