This topic is locked

Querying more than one value from a table

4/24/2007 6:13:30 PM
PHPRunner General questions
J
jahdel26 author

I would like to query more than one specific text value in the where clause (in bold) and can't seem to get it to work properly. The query below is what I am currently using and it works fine. Any assistance would be greatly appreciated. Thanks <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=5084&image=1&table=forumtopics' class='bbc_emoticon' alt=':rolleyes:' />
select `time`,

`tag`,

`value`

From `_logging`

where

`_logging`.`tag`="Tank Level 1" and

date_sub(now(),interval 5 minute)<`_logging`.`time`

J
Jane 4/25/2007

Try to use following query:

select `time`,

`tag`,

`value`

From `_logging`

where

`_logging`.`tag`='Tank Level 1' && date_sub(now(),interval 5 minute)<`_logging`.`time`

J
jahdel26 author 4/25/2007

Thanks Jane <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=17307&image=1&table=forumreplies' class='bbc_emoticon' alt=';)' />
After grouping with OR rather than AND everything worked great. I am using this query to pull specific data within the last five minutes from a rather large table, here is the modified query I used:
select `time`,
`tag`
`value`
from `_logging`
where
(`tag`="value 1" or
`tag`="value 2" or
`tag`=value 3") and
date_sub(now(),interval 5 minute)<`time`