Click here to Skip to main content
16,019,273 members
Home / Discussions / Database
   

Database

 
AnswerRe: ORM Rant Pin
Richard MacCutchan16-Jun-14 3:37
mveRichard MacCutchan16-Jun-14 3:37 
GeneralRe: ORM Rant Pin
Tomaž Štih16-Jun-14 3:51
Tomaž Štih16-Jun-14 3:51 
GeneralRe: ORM Rant Pin
Richard MacCutchan16-Jun-14 4:10
mveRichard MacCutchan16-Jun-14 4:10 
GeneralRe: ORM Rant Pin
Jörgen Andersson16-Jun-14 6:58
professionalJörgen Andersson16-Jun-14 6:58 
GeneralRe: ORM Rant Pin
Mycroft Holmes16-Jun-14 12:43
professionalMycroft Holmes16-Jun-14 12:43 
GeneralRe: ORM Rant Pin
Richard MacCutchan16-Jun-14 21:20
mveRichard MacCutchan16-Jun-14 21:20 
AnswerRe: ORM Rant Pin
Bernhard Hiller16-Jun-14 21:06
Bernhard Hiller16-Jun-14 21:06 
QuestionDistinct records on old school foxpro database file Pin
jkirkerx15-Jun-14 12:22
professionaljkirkerx15-Jun-14 12:22 
I've been messing with this for hours today. I'm trying to do this in 1 call to the database. Normally I would just get a list of unique items first, and then go back and get the numbers. Perhaps I'm trying to do something that can't be done, or it's just beyond my knowledge level, I'll take the latter of thought.

I need to get the qty sum and records of a sales history file

Item | qty | custNum | date
09-170 | 5 | 0014 | 01/20/1990
09-170 | 24 | 0014 | 02/21/1991
17-209 | 24 | 0014 | 03/15/1997
17-209 | 24 | 0014 | 08/15/2007

Results should be
Item | qty | desc | avg price
09-170 | 29 | trowel | 3.00
17-209 | 48 | kneepad | 24.00

So I wrote this to get the count of unique items which is 2. I'm not sure if my code returns the right number or not, because the database file contains thousands of records. I get 14, not reflective of the example above.

SELECT COUNT(FITEMNO) AS cCount
FROM
  (
      SELECT
       FITEMNO
       FROM ARTRS01.dbf
       WHERE FCUSTNO=@FCUSTNO
       GROUP BY FITEMNO
  )
UNION ALL
SELECT COUNT(FITEMNO) AS hCount
FROM
  (
      SELECT
       FITEMNO
       FROM ARTRS01H.dbf
       WHERE FCUSTNO=@FCUSTNO
       GROUP BY FITEMNO
  )


I wrote this to get the records, in which I get 36. I'm just testing on the history file, so there is no union to join the 2 database files yet. I keep getting 36 records with duplicates instead of 14 unique records.

SELECT FITEMNO, FSHIPQTY AS hItems"
FROM
  (
      SELECT h.FITEMNO, h.FSHIPQTY FROM ARTRS01H.dbf h WHERE h.FCUSTNO=@FCUSTNO GROUP BY FITEMNO, FSHIPQTY
  )

AnswerRe: Distinct records on old school foxpro database file Pin
GuyThiebaut15-Jun-14 22:03
professionalGuyThiebaut15-Jun-14 22:03 
GeneralRe: Distinct records on old school foxpro database file Pin
jkirkerx16-Jun-14 6:08
professionaljkirkerx16-Jun-14 6:08 
AnswerRe: Distinct records on old school foxpro database file Pin
Jörgen Andersson15-Jun-14 22:27
professionalJörgen Andersson15-Jun-14 22:27 
GeneralRe: Distinct records on old school foxpro database file Pin
jkirkerx16-Jun-14 6:11
professionaljkirkerx16-Jun-14 6:11 
AnswerRe: Distinct records on old school foxpro database file Pin
NitinDhapte16-Jun-14 23:30
NitinDhapte16-Jun-14 23:30 
Answer[SOLVED], I finally go it Pin
jkirkerx19-Jun-14 18:42
professionaljkirkerx19-Jun-14 18:42 
QuestionUnable to establish a connection to sql database 2005 Pin
Otekpo Emmanuel14-Jun-14 11:57
Otekpo Emmanuel14-Jun-14 11:57 
AnswerRe: Unable to establish a connection to sql database 2005 Pin
Kornfeld Eliyahu Peter14-Jun-14 19:22
professionalKornfeld Eliyahu Peter14-Jun-14 19:22 
QuestionSelective queries? Pin
Member 448708313-Jun-14 7:00
Member 448708313-Jun-14 7:00 
GeneralRe: Selective queries? Pin
Richard MacCutchan13-Jun-14 7:16
mveRichard MacCutchan13-Jun-14 7:16 
AnswerRe: Selective queries? Pin
PIEBALDconsult13-Jun-14 7:19
mvePIEBALDconsult13-Jun-14 7:19 
AnswerRe: Selective queries? Pin
Tim Carmichael13-Jun-14 7:35
Tim Carmichael13-Jun-14 7:35 
AnswerRe: Selective queries? Pin
Eddy Vluggen13-Jun-14 7:47
professionalEddy Vluggen13-Jun-14 7:47 
GeneralRe: Selective queries? Pin
Member 448708313-Jun-14 10:26
Member 448708313-Jun-14 10:26 
AnswerRe: Selective queries? Pin
jschell13-Jun-14 8:32
jschell13-Jun-14 8:32 
GeneralRe: Selective queries? Pin
Member 448708313-Jun-14 10:27
Member 448708313-Jun-14 10:27 
GeneralRe: Selective queries? Pin
Mycroft Holmes13-Jun-14 13:10
professionalMycroft Holmes13-Jun-14 13:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.