select within select or nested select??
Posted: Thu Apr 23, 2009 9:26 pm
Hi all... I have searched the forum, but I am either missing it or I don't understand enough to know how it applies to my situation so here goes.
I have one table, just one.
That table has product information in that includes spec data on each product.
the columns are like "specalum", "specwatt", "specfoo", "specbar", etc.
I want to return items that have spec data within ANY spec% column as long as that data is not empty like '' or 'N' since thats a flag meaning it doesn't apply to that product.
what I have so far is:
SELECT COLUMN_NAME FROM information_schema.`COLUMNS` C WHERE table_name = 'webitemmaster' AND COLUMN_NAME LIKE 'Spec%' ;
Which gives me a list of all the "Spec%" columns.... now I need to somehow search within each of those columns in the list for any value that is NOT '' or 'N'
I am new to SQL, so please bear with me... my table name is webitemmaster
Could some kind soul please point me in the right direction. I think a select within a select is right, but I dont know exactly how to express it.
Thank you so much for your time.
I have one table, just one.
That table has product information in that includes spec data on each product.
the columns are like "specalum", "specwatt", "specfoo", "specbar", etc.
I want to return items that have spec data within ANY spec% column as long as that data is not empty like '' or 'N' since thats a flag meaning it doesn't apply to that product.
what I have so far is:
SELECT COLUMN_NAME FROM information_schema.`COLUMNS` C WHERE table_name = 'webitemmaster' AND COLUMN_NAME LIKE 'Spec%' ;
Which gives me a list of all the "Spec%" columns.... now I need to somehow search within each of those columns in the list for any value that is NOT '' or 'N'
I am new to SQL, so please bear with me... my table name is webitemmaster
Could some kind soul please point me in the right direction. I think a select within a select is right, but I dont know exactly how to express it.
Thank you so much for your time.