SQL Code Help

D

d

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
 
K

KARL DEWEY

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;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top