If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > very tricky sql statement

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-17-04, 03:50
binarydream binarydream is offline
Registered User
 
Join Date: Oct 2003
Location: Sweden
Posts: 5
very tricky sql statement

Hi all

Got a very tricky sql statement, and I've been pulling my hair to boldness.
I need to make a comparison between 2 values


2 tables
tblData
tblMaster

2 columns
tblData.Forradssaldo
tblMaster.SS

SS=security stock
Forradssaldo=actual stock (Swedish)

SS i tblMaster is unique i that table, just one value
Forradssaldo has several value's per week

I want to compare(see) if SS is less than the SUM of Forradssaldo for the last week
and then show all Artikelnr that are less

tblData.InfogadVecka=inserted week (again Swedish)

' ' What I showed when I clicked on a article number(Artikelnr)
' strSQL2 = "SELECT SUM(Forradssaldo) AS FSaldo, SUM(Forradsvarde) AS FVarde, InfogadVecka" & _
' " FROM tblData WHERE Artikelnr= " & frmMain.lstArtikelNr.Text & " AND InfogadVecka BETWEEN " & _
' GetSetting(App.Title, "Settings", "StartDatum") & " AND " & GetSetting(App.Title, "Settings", "SlutDatum") & _
' " GROUP BY InfogadVecka"
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On