Forum Moderators: open

Message Too Old, No Replies

sql query and display of x items

don't know ahead of time which items should be displayed

         

macrost

8:35 pm on Oct 4, 2003 (gmt 0)

10+ Year Member



Ok, here's a fun one! (Not really, is kinda making me mad) I have a sql server i'm working from. Now the client wants to have 4 widgets a row, and all the widgets are stored in the database. I am using stored procedures for the selecting. Now when I get the information back, I have to test for each widget and then display if true. Is there a way to know which ones are true in advance? Either in code or by stored procedure?

Thanks!
Mac

txbakers

10:26 pm on Oct 4, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sounds like you need to add a simple where clause to your SQL statement.

macrost

10:36 pm on Oct 4, 2003 (gmt 0)

10+ Year Member



txbakers,
I thought of that but... the way the table is designed there say i have one supplier called vard. Now vard has 13 widgets and only 3 are true. How would I work that? Maybe I shouldn't work on the weekends!

Mac

txbakers

10:42 pm on Oct 4, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



select * from widgets where supplier = 'vard' and trueflag = 'true' limit 4

You just add the true flag to your query. What does it mean "only 3 are true"? You have to have some way to know whether the widget is true, right? Just add that into your whereclause.