Unknown column in where clause on wordpress database [closed] - sql

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I am selecting a value from wordpress database but I am having an error, I saw on many websites before and on this forum but nothing helped.
SELECT `meta_value`
FROM `wp_usermeta`
WHERE `meta_key`=`wp_capabilities`
AND `user_id` = 1;
Unknown column 'wp_capabilities' in 'where clause'

instead of wp_capabilities (`) you need to use 'wp_capabilities' ('). Please try this:
SELECT `meta_value`
FROM `wp_usermeta`
WHERE `meta_key`='wp_capabilities'
AND `user_id` = 1;

the column you want is configured with the roles and capabilities of wordpress. if you don't have it, maybe something was configured wrong when you installed wordpress. here you can read more about it.
https://wordpress.org/support/article/roles-and-capabilities/

Related

A newbie in SQL asking about functions [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 months ago.
Improve this question
How can I find data that dont end with letter 'g' without using NOT LIKE function, please help
select * from table where right(column, 1) != 'g'
Since you asked how to do it using "not like," I'll answer that. The function version provided by #Zoories would be more efficient.
This works at w3schools.com
SELECT * FROM Customers where CustomerName not like '%g';

Is there any way to put WHERE filter inside the SELECT statement in SQL? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed last year.
Improve this question
I got a task that i need to know how can i put WHERE clause inside the SELECT statement (like SELECT .... WHERE.... FROM...) . hope you guys could help me. thank you :)
'Where' is used to filter the data based on a condition.
The general syntax is:-
SELECT column1, column2, ...
FROM table_name
WHERE condition;
Here you can get a better overview.

SQL group by - can it be this simple? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
can someone please check if this is correct?
Not sure if my answer to Q6 is correct, I am not sure if the group_by I am using is right or not, the rest I think is ok
Thanks
You are close. You need to:
Use COUNT() instead of SUM().
There's no need to use the HAVING clause.
Optionally, you can add aliases to the columns, so they become easier to read.
Your query should look like:
select a.author_id, count(*) as titles, sum(b.quantity_ordered) as units
from a join b on a.book_id = b.book_id
group by a.author_id

i want to execute an sql query in ruby to use the result to make some tests in my views [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
this is the query :
SELECT COUNT(*)
FROM public.member_roles , public.members , public.users
WHERE public.users.id = public.members.user_id AND public.members.id = public.member_roles.member_id AND public.member_roles.role_id = 4 ;
in my views if this query return 1 , a text area is ganna be disabled
in rails
ActiveRecord::Base.connection.execute(your_sql_here)
you can find more info on this question. Hope this help you.
this will return Mysql2::Result object (if you are using mysql db and mysql2 gem. I belive for PG also it give similar object. to fetch data from it. here is a docs for Mysql2::Result.

Sql code to create the Mirror image of the string in Oracle sql [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
Team,
I need a sql query or function which will create the mirror image of string.
Thanks
Rajeev
If "mirror" is reversed text use:
SELECT REVERSE('my_text') FROM dual;
EDIT:
SqlFiddleDemo
SELECT t
,REVERSE(t) AS Mirror1
,TRANSLATE(t, 'abcdefghijklmnopqrstuvwxyz',N'ɐqɔpǝɟbɥıظʞןɯuodbɹsʇnʌʍxʎz') AS Mirror2
,TRANSLATE(REVERSE(t), 'abcdefghijklmnopqrstuvwxyz',N'ɐqɔpǝɟbɥıظʞןɯuodbɹsʇnʌʍxʎz') AS Mirror3
FROM tab;