Link to home
Create AccountLog in
Avatar of cpeters5
cpeters5

asked on

Convert MySQL query to Access

Below is a query in mySQL format.  
Would you please convert it to Excess?  Both databases are of the same schema.
Thank you so much,
pax

select a.ev_id evid, c.ntsb_no ntsb, c.ev_date date,
            c.inj_tot_f fatal, c.inj_tot_s serious, b.far_part part,
            narr_cause cause , narr_accf final
            from narratives a join aircraft b on a.ev_id = b.ev_id
            join events c on a.ev_id = c.ev_id
            where narr_cause like '%Fatigue%'
                  and (inj_tot_s > 0 or inj_tot_f > 0)
SOLUTION
Avatar of E C
E C
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
You might also need to enclose Date in square brackets since it is a reserved word in Access:

SELECT a.ev_id evid, c.ntsb_no ntsb, c.ev_date [date],
            c.inj_tot_f fatal, c.inj_tot_s serious, b.far_part part,
            narr_cause cause , narr_accf final
            FROM (narratives a INNER JOIN aircraft b on a.ev_id = b.ev_id) 
            INNER JOIN events c on a.ev_id = c.ev_id
            WHERE narr_cause LIKE  '*Fatigue*'
                  AND (inj_tot_s > 0 OR inj_tot_f > 0)

Open in new window

Avatar of cpeters5
cpeters5

ASKER

ecarbone
as mbixup, Access uses * as wild card.
 
mbixup,
Access complained about missing operator.  Apparently it does not like alias without "AS" After adding "AS" it now complained about "reserved words" or wrong punctuation...
But looks like we are geting there.
We cross posted...

Did you see my comment about enclosing the alias Date in square brackets?

Post the query as you have it now...
ASKER CERTIFIED SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Hi cpeters5,
I am pretty sure you can use %, but * will work as well.
See this link.

Are you using the SQL Query Designer ?
I provided part of the answers myself