I created following table
create table publisher(
name varchar(20),
city varchar(20)
)
I want to run following requirement:
list all the positions of charcter 'a' from name.
For this, Ii ran following query:
select patindex('%a%', name)
from publisher;
But, it doesn't show proper output. When i put 'city' column instead of 'name' column, it shows right output. What is the problem?
Also, I want to display the name of publishers whose getting minimum and maximum profit. for this, i ran following query:
select name, max(profit), min(profit)
from publisher;
It shows the error like that "'name' is not part of aggregate function". what should i do for retrieving name of publishers who getting minimum and maximum profit.