Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM SQL » View Thread |
Messages 1 to 3 of 3 total |
How used a null value in select field with union |
Wed, Jun 10 2009 9:06 AM | Permanent Link |
Eric Derrien | my query :
Select D.ID, D.Client, D.NoFact, D.DateFact, D.Values, Sum(D.TTC_Montant) As Ttc, Sum(R.MtRegle) As Regler, Sum(D.TTC_Montant - R.MtRegle) As Solde From Documents D Left Outer Join Reglement R On R.Document = D.ID Where Removed = 0 And FastFilter = 5 Group By D.ID, D.Client Union All Select -1, -1, '', Min(DateFact), Min(D.Values), Sum(D.TTC_Montant), Sum(R.MtRegle), Sum(D.TTC_Montant - R.MtRegle) From Documents D Left Outer Join Reglement R On R.Document = D.ID Where Removed = 0 And FastFilter = 5 Order By 6 I have a problem with second select, D.Values is a memo field and D.DateFact is a date field With the SQL engine as DB2, SQL Server, Oracle, I used to put NULL in place of the fields (D.DateFact And D.Values) not required like this Select -1, -1, '', Null, Null, Sum(D.TTC_Montant), Sum(R.MtRegle), Sum(D.TTC_Montant - R.MtRegle) For resolve this problem I put the function Min () for the date field but this does not works on the Memo field how can I do? |
Wed, Jun 10 2009 11:21 AM | Permanent Link |
Fernando Dias Team Elevate | Eric,
NULL values have no type, so you must cast them so that DBISAM can match the types of the corresponding columns: .... UNION ALL SELECT -1, -1, '', CAST(NULL AS DATE), CAST(NULL AS MEMO), Sum(D.TTC_Montant), Sum(R.MtRegle), Sum(D.TTC_Montant - R.MtRegle) .... -- Fernando Dias [Team Elevate] |
Wed, Jun 10 2009 11:31 AM | Permanent Link |
Eric Derrien | Perfect
Thanks |
This web page was last updated on Tuesday, April 30, 2024 at 03:55 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |