use
SELECT COUNT(DISTINCT productId) from table_name WHERE keyword='$keyword'
More Related Contents:
- INSERT INTO SELECT statement with more columns which is not in another table
- MySQL how to fill missing dates in range?
- Left Outer Join doesn’t return all rows from my left table?
- ‘IF’ in ‘SELECT’ statement – choose output value based on column values
- 1052: Column ‘id’ in field list is ambiguous
- How to split the name string in mysql?
- Can a foreign key reference a non-unique index?
- Why does MySQL allow “group by” queries WITHOUT aggregate functions?
- Cumulative sum over a set of rows in mysql
- How to set a maximum execution time for a mysql query?
- Set NOW() as Default Value for datetime datatype?
- SQL keys, MUL vs PRI vs UNI
- Add Auto-Increment ID to existing table?
- MySQL SELECT DISTINCT multiple columns
- How to copy a row and insert in same table with a autoincrement field in MySQL?
- SQL DELETE with JOIN another table for WHERE condition
- How to change the default port of mysql from 3306 to 3360
- How to move columns in a MySQL table?
- Using group by on two fields and count in SQL
- Can MySQL convert a stored UTC time to local timezone?
- Whats the fastest way to lookup big tables for points within radius MySQL (latitude longitude)
- quick selection of a random row from a large table in mysql
- How can we find gaps in sequential numbering in MySQL?
- MySQL CONCAT returns NULL if any field contain NULL
- Does Order of Fields of Multi-Column Index in MySQL Matter
- Alternative to using LIMIT keyword in a SubQuery in MYSQL
- How to check if field is null or empty in MySQL?
- mysql select id and name from other table and join query
- Convert SQL Server query to MySQL [duplicate]
- comparison of truncate vs delete in mysql/sqlserver [duplicate]