Sublime directory Surf the web anonymous Pagerank Monitor


Select AS question

AndieR
Fri 2 October 2009, 03:58 am GMT +0200
Hello to All,

I've been trying something like this and it doesn't work:

SELECT *,idcat AS cat,idsubcat AS subcat FROM products WHERE 11 IN (cat) AND 34 IN (subcat) AND active!='no'

This is the error it gives me: Unknown column 'cat' in 'where clause'

Any suggestions would be greatly appreciated!

To give you more details this works:

SELECT * FROM products WHERE FIND_IN_SET('$idcat', idcat) AND FIND_IN_SET('$idsubcat', idsubcat) AND active!='no'

But I've read it can return false positives so that's why I was trying to find a workaround... Any comments?

Thank you!
Andie

Nikolas
Sat 10 October 2009, 01:39 pm GMT +0200
The part "WHERE 11 IN (cat)" should be "WHERE cat IN (11)" or even better "WHERE cat = 11"

AndieR
Sat 10 October 2009, 03:49 pm GMT +0200
Thanks for the reply, but cat and subcat are comma separated values pulled from the database so I can't do it the way you mention.

nigel
Fri 5 November 2010, 12:36 pm GMT +0100
why not try:
SELECT idcat AS cat && idsubcat AS subcat FROM products WHERE 11 IN (cat) AND 34 IN (subcat) AND active!='no'

i dont know if it'll help.. just sharing my thoughts :)

shania david
Wed 5 January 2011, 09:06 am GMT +0100
What RDMS you are using?? May be you have to search it on Google...

jeffreylee
Tue 18 January 2011, 05:34 pm GMT +0100
can you please show me the values of table?

richerdjohn
Sun 24 April 2011, 10:17 am GMT +0200
've been trying something like this and it doesn't work:

SELECT *,idcat AS cat,idsubcat AS subcat FROM products WHERE 11 IN (cat) AND 34 IN (subcat) AND active!='no'

This is the error it gives me: Unknown column 'cat' in 'where clause'

Any suggestions would be greatly appreciated!

timpane
Mon 26 December 2011, 05:44 pm GMT +0100
this is very much nice to have such an important source of information to have...

Archive for SMF v1.00 by N.P. Valid XHTML 1.0 Transitional