Jump to content

SQL database search question


Recommended Posts

Hello everybody,

I want to start a script and did some research on the forum but I have not a clearly answer for a question about SQL database search.

It is possible to compare a value from a column with another value from another column but the same row?

In attachment I put a representative picture for my question

Thanks,

Have a nice Week!!!

post-58816-0-29046800-1330902478_thumb.p

Link to comment
Share on other sites

Yes of course but you need to tell us exactly how you want your comparison to work: is it part of the condition that select row(s) or is it something else?

SELECT tell_us_what FROM your_table WHERE minim > status5;

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Hello,

Basically I want to know if the value of Status 5 is less than the value of Minim from Part 1. If it's smaller then I want to write in a file certain data, such Part1 and difference values ​​between Minim and Status 5.

:oops:

Thanks,

Link to comment
Share on other sites

@jchd has given you the correct SQL statement for returning the rows where status5 < minim. I'm not sure what else you want. If your question is related to setting up the database connection and querying it, then you need to be more specific and let us know what kind of database it is, where it's located, etc.

Edited by zorphnog
Link to comment
Share on other sites

I still don't know which SQL engine you use, so the syntax below may need minor changes.

select part, minim - "status 5" as diff from mytable where part = 'Part 1' and diff > 0;

Then you obtain either an empty resultset or one row (assuming parts are unique) with only two values: the Part value and the difference you look for, which you can then treat as you want.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...