hi
I have this kind of situation
2 tables, ip_masks and new_ip
(ip_masks)
ip
1.1.1
2.2.2
3.3.3
.........
(new_ip)
ip
1.1.1.1
2.2.2.2
4.4.4.4
........
so as you see the ip_mask table contains only the first 3 groups of an IP
what i need is to write a code that will select from new_ip ONLY those IPs that are in ip_mask table in a class C form
so, in our example, those would be 1.1.1.1 and 2.2.2.2
I am trying something like this
SELECT *
FROM new_ip
WHERE new_ip.ip REGEXP ' ^(SELECT * FROM ip_mask)'
which obviously doesn't work
please notice that what i try to do is WILDCARDING an SQL query but i guess the SQL simply doesn't understand that as a query but rather accepts as a string
please someone tell me how is it possible to do ?
also, it is acceptable to solve the problem in PHP if it would be executing quicker .. please tell me if the SQL or PHP would do the job faster ?
Thanks
2007-01-16
18:52:48
·
4 answers
·
asked by
Zettag
2
in
Computers & Internet
➔ Programming & Design