From: jo on 19 May 2010 16:22 I have two tables say A and B, what I am trying to achieve with the query is just to display records that have the received field ticked in table A and the colour field in table B not containing �Y�. How do I modify the code below to achieve this? SELECT A_Date, A.Received, A.ID, B. Colour FROM A LEFT JOIN B ON DDP_A.Main = B.Main WHERE (((A.Received)= -1) AND ((B.Colour <> �Y�));
From: Marshall Barton on 19 May 2010 16:47 jo(a)jo.uk wrote: >I have two tables say A and B, what I am trying to achieve with the query is >just to display records that have the received field ticked in table A and >the colour field in table B not containing �Y�. > >How do I modify the code below to achieve this? > >SELECT A_Date, A.Received, A.ID, B. Colour >FROM A LEFT JOIN B > ON DDP_A.Main = B.Main >WHERE (((A.Received)= -1) AND ((B.Colour <> �Y�)); Did you Copy/Paste that query or retype it? It looks like it would do what you asked if you fixed the bad table and field names and the unbalanced Parenthesis. Maybe the Join should be INNER JOIN so you know there sould be a B.Color value to check. -- Marsh MVP [MS Access]
From: jo on 19 May 2010 17:21 The code was just to demonstrate what I had in mind. I have updated the example regarding bad table and field names. Could you help with the unbalanced Parenthesis? SELECT A.Date, A.Received, A.ID, B. Colour FROM A inner JOIN B ON A.Main = B.Main WHERE (((A.Received)= -1) AND ((B.Colour <> "Y"));
From: KARL DEWEY on 19 May 2010 19:10 For every open you gotta have a close. Try this -- SELECT A.Date, A.Received, A.ID, B. Colour FROM A inner JOIN B ON A.Main = B.Main WHERE (A.Received= -1) AND (B.Colour <> "Y"); -- Build a little, test a little. "jo(a)jo.uk" wrote: > The code was just to demonstrate what I had in mind. > > I have updated the example regarding bad table and field names. Could you > help with the unbalanced Parenthesis? > > SELECT A.Date, A.Received, A.ID, B. Colour > FROM A inner JOIN B > ON A.Main = B.Main > WHERE (((A.Received)= -1) AND ((B.Colour <> "Y")); > . >
From: Marshall Barton on 19 May 2010 22:32 jo(a)jo.uk wrote: >The code was just to demonstrate what I had in mind. > >I have updated the example regarding bad table and field names. Could you >help with the unbalanced Parenthesis? > >SELECT A.Date, A.Received, A.ID, B. Colour >FROM A inner JOIN B > ON A.Main = B.Main >WHERE (((A.Received)= -1) AND ((B.Colour <> "Y")); Access's over enthusastic use of parenthesis might have confused you. There should have been a ) just before the semicolon. But, in this case, none of them are needed so you can just remove all of them. -- Marsh MVP [MS Access]
|
Next
|
Last
Pages: 1 2 3 Prev: Mid string null value Next: Updating text field to new numeric field & moving minus sign to fr |