Jump to content

select query - compare value of one field with parsed value of another field


mcwdes

Recommended Posts

Table

 

1     3     #1,#2

2     5     #2,#3

3     3     #1,#2,#3

4     4     #4

5     5     #1,#2,#3

6     5     #1,#2,#3

7     4     All

8     3     #1,#2,#3

 

Need to compare the value of field2 with the occurrences of "#" in field3.

Tried this:

$query_plcResultsSet = "SELECT * FROM Table WHERE RteType IN ('Mainline', 'Connector') AND StartDateD = '$strchvarval' AND (field2 = 'All' OR " . substr_count(field3, '#') . " = field2)";

I know this won't work and I think I know why, but don't know how to solve.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.