Putting in line comments in sql view for Access 2016 - ms-access

I am trying to figure out how to put in line comments in Access.
I have seen the below post and have been trying to put through the solution from Dan which includes the WHERE Clause however it comes up with a "Syntax error (missing operator) in query expression AND "Comment FYI, This is a comment"<>"".
Script I have put through below for reference:
SELECT prod_name
FROM products
WHERE
AND "Comment: FYI, This is a comment"<>"";
How do you comment an MS-access Query?
Thanks!

The answer assumes that there is something else in the WHERE clause.
If there isn't, you would simply do:
SELECT prod_name
FROM products
WHERE "Comment: FYI, This is a comment"<>"";

Related

Expected output is not right in mysql in hackerEarth

I am practicing in hackerEarth SQL and I came to this
My answer is : SELECT name FROM places WHERE rating >= 4.0.
Why is it wrong? The expected output should be
what is something wrong in my query? Thank you
You have to add another condition in where clause along with rating>4
-Execute only "Select Category" and you will find the relevant info

why ami getting this #1305 - FUNCTION homeshopping.partID does not exist

mysql php admin table query enter image description here
I don't see why it says partID is giving me a problem? it is in the table and i think i have them linked correctly. I Have changed a few things i replaced comma with the and statement which cleared up alot of my errors. But since I've done that it continues to give me #1305 - FUNCTION homeshopping.partID does not exist. I have even looked at the structures an designer to make sure column names an tables are correct.
Don't forget to post your query as text also.
Because it's missing the keywork IN to have a query like this:
SELECT CONCAT(hscust.first,' ', hscust.last AS Customer,hsitems.description,hsitems.price,hsitems.itemCalss
FROM hscust,hsorders,hslineitem,hsitems
WHERE hslineitems.orderId = hsorders.orderId AND hsitems.partID = hslineitem.partNum AND hslineitem.price = hsitems.price AND partID IN ('CB03', 'CZ82');

HQL Query - issue in where clause by using alias name

I got a exception in my where clause. I have the following HQL-Query:
SELECT a.addressType as myowncolumn
FROM Address a
WHERE myowncolumn = 1
I got the following error message:
Unknown column "myowncolumn" in where clause
If I remove the where clause the query is valid.
What´s wrong?
Could you help me, please.
Your entity "must know" (have the links through fields) about myowncolumn. For example, if Address has reference to City and them to Country, then this hql query will be correct:
select adr from Address a where a.city.country.name='UK';
That doesn't work even in plain SQL, and you are right in your comment that SQL is validated from inside out / right to left. That's why myowncolumn isn't recognized.

MySQL - Data with the symbol "&"

I have the below data in my MySQL table "categories":
id Name
-----------------
1 Books & CDs
2 Dress
When I try to get the value from table it works fine with below SQL.
SELECT * FROM `categories` WHERE `name` = 'Books & Cds';
But when using in PHP, it gives me some SQL error.
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an
error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near '' at line 5
Where can I find the actual reason for this? How to debug this?
If you want to search for rows in your Category table in your PHP code, I recommend that you add a column in your table for a code to use instead of searching on the name that you use for the end users. The potential problem that you're facing is that if you want to change the name of a category, you'd have to find everywhere in your code that you referred to that category by name and change it too. But if your table looked like this:
ID code name
1 BCDS Books & CDs
2 DRS Dress
then your code can do things like "where code = 'BCDS'" and you can call that category "Books & CDs", "CDs and Books", or anything else you like.
Now, as far as fixing your syntax problem, you'll have to post the PHP that you use to generate the query that fails. As another poster said, you're probably escaping something incorrectly and MySQL isn't getting the query you think it's getting.

how to comment sentence in sql query - in access 2007?

how to comment sentence in sql query - in access 2007 ?
thank's in advance
According to this, you can't comment SQL code. To comment VBA code use a single quote (').
Here's one way:
SELECT query_comment_goes_here
(SELECT * FROM Employees WHERE 1 = 0),
O1.OrderID, O1.CustomerID, O1.OrderDate
FROM Orders AS O1;
If you're not trying to place a remark on a specific line of the code, but for the overall query, you can enter it in the Description under the query properties.