Shoutbox

access query - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: access query (/showthread.php?tid=87041)

access query by Jarrod on 11-03-2008 at 06:16 AM

i have an access db with 10 different fields i want to make a number of different queries, but i want to query 7 out of the 10 fields each time and i can't get the query right so does anyone have any ideas?


RE: access query by Adeptus on 11-03-2008 at 06:47 AM

"SELECT OneThing, AnotherThing, ThirdThing FROM SomeTable"?


RE: access query by Jarrod on 11-03-2008 at 06:56 AM

code:
SELECT Table.ID, Table.SNAME, Table.FNAME, Table.L1
FROM table
WHERE (((Table.L1) Like "text**"));
thats what it looks like for one field, and every time i try add Table.L2 i stuff it up somehow
RE: access query by Adeptus on 11-03-2008 at 07:05 AM

I think you are getting parenthesis-happy there.  I see nothing that calls for use of all those parenthesis.

code:
SELECT Table.ID, Table.SNAME, Table.FNAME, Table.L1
FROM table
WHERE Table.L1 Like "text**"


...should be perfectly fine.  If you want to add another column to the condition, you could do something like:

code:
SELECT Table.ID, Table.SNAME, Table.FNAME, Table.L1
FROM table
WHERE Table.L1 Like "text**" AND Table.L2 <> 2

RE: access query by Jarrod on 11-03-2008 at 07:14 AM

quote:
Originally posted by Adeptus
I think you are getting parenthesis-happy there.  I see nothing that calls for use of all those parenthesis.

code:
SELECT Table.ID, Table.SNAME, Table.FNAME, Table.L1
FROM table
WHERE Table.L1 Like "text**"


...should be perfectly fine.  If you want to add another column to the condition, you could do something like:

code:
SELECT Table.ID, Table.SNAME, Table.FNAME, Table.L1
FROM table
WHERE Table.L1 Like "text**" AND Table.L2 <> 2


that sql was generated by access
using your query i get

quote:
Originally posted by access 07
data type mismatch in crirtia expression