I Need Help This Time

Hi everyone I have got a coding issue that is giving me fits.

Here is what’s up.

I have a datatable called dtoperators. It has columns

DBName

TableName

ColumnName

Operator

OperatorValue

ADV

What i need to do is loop through the rows of this table. All rows that have the same value in DBName, TableName, ColumnName and ADV = “OR” should be written to a string with a parenthesis around it. Those with ADV = “AND” do not need parenthesis and simply get written with an “AND” between each string.

If anyone can help I would be appreciative! It’s kind of due soon.

Technorati Tags: ,,,,,

Advertisements
  1. #1 by Jon on March 20, 2009 - 9:02 am

    Hey Kelly, I will look into this a bit today and see what I can come up with for you. =)

  2. #2 by Kelly on March 20, 2009 - 9:59 am

    So you know I did come up with a solution. It is ugly but it seems to work. WIll probably post about it on Monday.

  3. #3 by Unknown on March 20, 2009 - 10:24 am

    Use a select statement that groups by DBName, TableName and ColumnNameThen use that result set to filter the table by the results.You can do the filtering in code if the table is not too large and you need speed.

  4. #4 by Jeremy on March 20, 2009 - 2:16 pm

    Is this HTML or C or C++ or what? 🙂

  5. #5 by Jeremy on March 20, 2009 - 3:16 pm

    Sorry…don\’t know that. Just Java and some basic HTML. 🙂

  6. #6 by Jon on March 20, 2009 - 3:54 pm

    Sorry I wasn\’t able to look at this earlier. I have spent a week in jQuery custom validation hell and just now have an opportunity to hop on it. If you still want a ifferent perspective I\’ll post something to look at.

  7. #7 by Jeffrey on March 20, 2009 - 5:52 pm

    I\’m not sure I understand, but could you do this in two passes using a query like this for the "OR" pass and adding the begin and end parenthesis when the ColumnName breaks when needed?SELECT dtoperators.DBName, dtoperators.TableName, dtoperators.ColumnName, dtoperators.Operator, dtoperators.OperatorValue, dtoperators.ADVFROM dtoperatorsWHERE (((dtoperators.ADV)="OR"))ORDER BY dtoperators.DBName, dtoperators.TableName, dtoperators.ColumnName, dtoperators.ADV ;And then a second pass for the "AND" where you just run them all together?SELECT dtoperators.DBName, dtoperators.TableName, dtoperators.ColumnName, dtoperators.Operator, dtoperators.OperatorValue, dtoperators.ADVFROM dtoperatorsWHERE (((dtoperators.ADV)="AND"))ORDER BY dtoperators.DBName, dtoperators.TableName, dtoperators.ColumnName, dtoperators.ADV ;Maybe a UNION of some sort? Anyway, I\’m not even sure what you\’re looking for exactly. So, maybe this helps, and maybe it\’s way off???

  8. #8 by Docextreme on March 21, 2009 - 6:07 am

    Can you give us a example of what your trying to do Kelly I am very good with tables and so on but I am not sure I understand what your trying to do….I can drop a few links to very helpful sites if you like.

  9. #9 by Kelly on March 21, 2009 - 4:04 pm

    Thank you all much for your suggestions. Hey Doc let me know if the next post explained it better.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: