Ask Your Question
0

base trouble with critirion in a query [closed]

asked 2017-10-07 22:29:00 +0100

pascale gravatar image

updated 2017-10-07 22:30:49 +0100

Hi, I am having trouble with the results of a query, here is the sql;

SELECT "EBSales"."shades", "EBSales"."Prix de vente" AS "EU TTC Devise", "EBSales"."NDT", "EBSales"."Quantité", "EBSales"."Payé le" AS "Date", "paypal"."Rate", "Quantité" * "Prix de vente" * "Rate" AS "EU TTC €", "EBSales"."Pays" FROM "EBSales", "paypal" WHERE "EBSales"."NDT" = "paypal"."NDT" AND ( "EBSales"."shades" IS NOT NULL AND "EBSales"."Pays" = 'Royaume-Uni' OR "EBSales"."Pays" = 'Malte' OR "EBSales"."Pays" = 'Irlande (Eire)' OR "EBSales"."Pays" = 'Grèce' OR "EBSales"."Pays" = 'Allemagne' OR "EBSales"."Pays" = 'Chypre' OR "EBSales"."Pays" = 'Pays-Bas' OR "EBSales"."Pays" = 'Danemark' OR "EBSales"."Pays" = 'Suisse' OR "EBSales"."Pays" = 'Italie' OR "EBSales"."Pays" = 'Luxembourg' )

And here is a screen shot image description

In the first column "Shades" I only want to see rows which have a LS number ie "IS NOT EMPTY" but for certain countries in my list that are part of the eu appear!.

I have changed the "OR" for "AND" which left a blank table, and I have gone into "query properties" and changed the distinct values to yes but this only added more rows with the first column empty. Any Ideas??? kind regards Paul

NB, I have another query with only one country that work great

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by pascale
close date 2017-10-08 12:01:01.495140

1 Answer

Sort by » oldest newest most voted
1

answered 2017-10-07 23:08:26 +0100

Ratslinger gravatar image

Here is what I understand you want. Three conditions for the selected criteria.

  • "EBSales"."NDT" = "paypal"."NDT"

AND

  • "EBSales"."shades" IS NOT NULL

AND with both of those only if it is one of the eleven countries specified by the OR statements.

If that is the case it is a problem with the grouping of your conditions. After this portion or your statement

 ("EBSales"."shades" IS NOT NULL AND

enclose the remaining OR conditions with an added set of parenthesis.

edit flag offensive delete link more

Comments

Ooooooo mr @Ratslinger you are magic!!!! I knew it would be something simple, (but still far to complicated for me!) Thank you so much. Kind regards Paul

pascale gravatar imagepascale ( 2017-10-08 11:57:12 +0100 )edit

Question Tools

1 follower

Stats

Asked: 2017-10-07 22:29:00 +0100

Seen: 26 times

Last updated: Oct 07 '17