14, February 2012

Select AS question - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  Databases
Topic: Select AS question
« previous next »
Pages: [1] Print
Instabuck - The easy way to sell digital products online

Author Topic: Select AS question  (Read 1664 times)
Google dot what?
*
Posts: 2
16 credits
Members referred : 0


« on: Oct 02, 2009, 03:58:51 am »

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
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5779
46271 credits
Members referred : 3



« Reply #1 on: Oct 10, 2009, 01:39:23 pm »

The part "WHERE 11 IN (cat)" should be "WHERE cat IN (11)" or even better "WHERE cat = 11"

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Google dot what?
*
Posts: 2
16 credits
Members referred : 0


« Reply #2 on: Oct 10, 2009, 03:49:22 pm »

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.
Cyberpunk Wannabe
*
Posts: 38
246 credits
Members referred : 0


« Reply #3 on: Nov 05, 2010, 12:36:26 pm »

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 Smiley
I feel pretty...
***
Posts: 180
1120 credits
Members referred : 0


« Reply #4 on: Jan 05, 2011, 09:06:52 am »

What RDMS you are using?? May be you have to search it on Google...
What a dork
*
Posts: 17
102 credits
Members referred : 0


« Reply #5 on: Jan 18, 2011, 05:34:59 pm »

can you please show me the values of table?
My Name is Enigo Montoya
*
Posts: 32
192 credits
Members referred : 0


« Reply #6 on: Apr 24, 2011, 10:17:38 am »

'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!
Novice Spammer
***
Posts: 102
652 credits
Members referred : 0


« Reply #7 on: Dec 26, 2011, 05:44:00 pm »

this is very much nice to have such an important source of information to have...
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=9172
Tags : mysql SELECT AS IN FIND_IN_SET Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  Databases
Topic: Select AS question
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Feb 14, 2012, 02:34:53 pm





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.