A Microsoft Office (Excel, Word) forum. OfficeFrustration

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   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

SQL Code Help



 
 
Thread Tools Display Modes
  #1  
Old December 17th, 2009, 10:06 PM posted to microsoft.public.access.queries
[email protected]
external usenet poster
 
Posts: 10
Default SQL Code Help



Hi,all

Could someone help me out with some SQL code to resolve the following issue?
I need to generate one piece of SQL code to be used by a report via a query
in access 2003.


Below is an example of three items of data that I need the query to use

If Pa=a or Pa =b and AL = no information in field AND DU=0 then TF = “ No
Data” then display result with ID

If Pa=a or Pa =b and AL = has got information in field AND DU=0 then TF =
“Data” then display result with ID

If TR =”ComP” and DU=0 then display result with ID

The query would need to ORDER BY fields RID, IDA in Ascending

The table is called SLD

Reference to TF is to a temporary reference (not part of the table)

Reference to AL is to test this field in the table for the presents or not
of data

Reference to ID is the record Reference field
Thank you
  #2  
Old December 18th, 2009, 12:11 AM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default SQL Code Help

If TR =”ComP” and DU=0 then display result with ID
Display what?

Maybe this --
SELECT ID, RID, IDA, IIF(TR =”ComP” and DU=0, "Data", IIF((Pa="a" OR Pa
="b") AND (AL = "" OR AL = Null) AND DU=0, “ No Data”, "Data”)) AS TF
FROM SLD
ORDER BY RID, IDA;


--
Build a little, test a little.


" wrote:



Hi,all

Could someone help me out with some SQL code to resolve the following issue?
I need to generate one piece of SQL code to be used by a report via a query
in access 2003.
Below is an example of three items of data that I need the query to use

If Pa=a or Pa =b and AL = no information in field AND DU=0 then TF = “ No
Data” then display result with ID

If Pa=a or Pa =b and AL = has got information in field AND DU=0 then TF =
“Data” then display result with ID

If TR =”ComP” and DU=0 then display result with ID

The query would need to ORDER BY fields RID, IDA in Ascending

The table is called SLD

Reference to TF is to a temporary reference (not part of the table)

Reference to AL is to test this field in the table for the presents or not
of data

Reference to ID is the record Reference field
Thank you
.

  #3  
Old December 19th, 2009, 02:51 PM posted to microsoft.public.access.queries
[email protected]
external usenet poster
 
Posts: 10
Default SQL Code Help

Thank you for pointing me in the right direction
 




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:00 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.