Hello Team I new to ACCESS, getting a syntax error for the below query
I think your problem is all the double quotation marks. Try this:
SELECT HRMNZ_TRF_SCH.HRMNZ_TRF_SCH_NO, HRMNZ_TRF_SCH.SCH_B_CMDTY_CD, CAT_ID_HTSUSA_XREF.CAT_ID_NO_20, CAT_ID_HTSUSA_XREF.LAST_UPDT_TS, CAT_ID_HTSUSA_XREF.LAST_UPDT_LOGON_ID
FROM Z1TJ111$.HRMNZ_TRF_SCH HRMNZ_TRF_SCH INNER JOIN Z1TJ111$.CAT_ID_HTSUSA_XREF.CAT_ID_HTSUSA_XREF ON HRMNZ_TRF_SCH.HRMNZ_TRF_SCH_NO=CAT_ID_HTSUSA_XREF.HRMNZ_TRF_SCH_NO
WHERE NOT (HRMNZ_TRF_SCH.HRMNZ_TRF_SCH_NO='7211.23.3000' OR HRMNZ_TRF_SCH.HRMNZ_TRF_SCH_NO='8427.20.8000' OR HRMNZ_TRF_SCH.HRMNZ_TRF_SCH_NO='8427.90.0000' OR HRMNZ_TRF_SCH.HRMNZ_TRF_SCH_NO='8525.50.7010' OR HRMNZ_TRF_SCH.HRMNZ_TRF_SCH_NO='8525.60.1050' OR HRMNZ_TRF_SCH.HRMNZ_TRF_SCH_NO='8526.10.0040' OR HRMNZ_TRF_SCH.HRMNZ_TRF_SCH_NO='8526.91.0020' OR HRMNZ_TRF_SCH.HRMNZ_TRF_SCH_NO='8526.91.0040' OR HRMNZ_TRF_SCH.HRMNZ_TRF_SCH_NO='8527.99.1500' OR HRMNZ_TRF_SCH.HRMNZ_TRF_SCH_NO='9014.10.7080') AND HRMNZ_TRF_SCH.HRMNZ_TRF_SCH_NO<>HRMNZ_TRF_SCH.SCH_B_CMDTY_CD
Use the query editor to get tips about what is wrong. If you don't know how here is a tutorial: https://www.tutorialspoint.com/ms_access/ms_access_sql_view.htm
Related
I have a calculated field on a table at MS Access and I'd like to use the following syntax, but it returns a syntax error pop-up and and I'm wondering which part is wrong. Could you please help with this? Thanks a lot.
IIf([Letter_Grade]="A+",4,IIf([Letter_Grade]="A",4,IIf([Letter_Grade]="A",3.7,IIf([Letter_Grade]="B+",3.3,IIf([Letter_Grade]="B",3,IIf([Letter_Grade]="B",2.7,IIf([Letter_Grade]="C+",2.3,IIf([Letter_Grade]="C",2,IIf([Letter_Grade]="C",1.7,IIf([Letter_Grade]="D+",1.3,IIf([Letter_Grade]="D",1,IIf([Letter_Grade]="D-",0.7,IIf([Letter_Grade]="F",0)))))))))))))
Try adding ",null" after your last expression:
IIf([Letter_Grade]="F",0,null)))))))))))))
Though it may be better to use a query?
The function works well, did you put = operator before it.
Attached are some images of the results I got and the function
Here is the link to my sql code
https://www.mycompiler.io/view/5Lecen1
I don't know why but this is giving error when I am running it in an online sql compiler. It is giving a syntax error but when I am removing the operator "some" it is working fine. This is happening only when I use "some or any" keywords in subqueries can someone please help me find out what am I doing wrong
Syntax for SOME specifies the equality operator as '=', not '==':
https://dev.mysql.com/doc/refman/8.0/en/any-in-some-subqueries.html
I get the usual errors ( already tried to read previous questions ) Query failedYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''','',now(),'','This is great! ','', 'published')' at line 1
Thank you for helping!!
Here is my code:
My Code
The page in question is here:enter link description here
Thanks you very much for helping
The problem was on the line 20--> $query .= "VALUES({$post_category_id}. It need to be quotes around '{$post_category_id}'.
I don't know exactly why. the category id is a number , so for that shouldn't be around quotes because is a number.That's how our teacher explained to as.Thanks for your help.
The $connection variable isn't defined anywhere...
I just populated your page with some example data and that was the query I got:
INSERT INTO posts(post_category_id, post_title, post_author,post_date,post_image,post_content,post_tags,post_status) VALUES(,'','',now(),'',' Test','', 'Test')
The problem is near the VALUES keyword: VALUES (, is wrong. You should check first if every input value is populated correctly, eg if $post_category_id is defined with a valid value.
I am executing the follow mysql query and getting error saying wrong syntax.
SELECT COUNT(*) FROM PS.INFO WHERE IPADDRESS='1.1.1.1' AND ID='YYY' AND (TYPE='PAID' 0R TYPE='FREE') AND EXPIRYTIME IS NULL;
Please help me out with the correct syntax?
Your wrote 0R (zero-R) instead of OR (O-R).
TYPE='PAID' 0R TYPE='FREE'
OR
appears to have a zero instead of an O
The error always tells you where to look. In this case it says "near '0R..."
And sure enough, that's a zero, not an O. It should be the word OR.
I'm converting an app to use SQL Server 2008 that is currently using SQLite. How would I do the following view in SQL Server 2008? I can't seem to figure out the syntax for calling multiple tables:
CREATE VIEW new_mimetypes AS
SELECT
DISTINCT fd.mimetype AS 'newMimetype'
FROM
files_detail AS fd
WHERE
NOT EXISTS (
SELECT
m.mimetype
FROM
mimetypes AS m
WHERE
fd.mimetype = m.mimetype
)
[EDIT]
Nevermind. SQL Server Management Studio was complaining about syntax errors but it still took the SQL. That's what I get for thinking the IDE new what would work!
That syntax looks correct, are you getting an error?
I agree with #Adam Ruth that the syntax looks correct. I also wanted to add that you could use the "EXCEPT" operator as well to achieve the desired result:
CREATE VIEW [dbo].[new_mimetypes]
AS
SELECT mimetype As 'newMimetype' FROM files_detail
EXCEPT
SELECT mimetype FROM mimetypes