Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL - how to get specific value of cell?

Tags:

sql

mysql

Fist time using SQL and already confused. I have a table :

A  |  B
--------
a  | 6
b  | 10
c  | 12

I want to filter it by using string comparison, but getting the value of the second column :

myNum = SELECT B WHERE A ='a'

At the end I want the value of myNum to be 6.

Just can't get it right... any help would be very appreciated!

like image 790
user1386966 Avatar asked Mar 22 '23 03:03

user1386966


1 Answers

You need to specify table name.

SELECT B from table_name WHERE A = 'a';
like image 72
Raghvendra Parashar Avatar answered Mar 24 '23 18:03

Raghvendra Parashar