top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

Please help me to know if I can use WHERE and HAVING both in same query?

+2 votes
66 views
Please help me to know if I can use WHERE and HAVING both in same query?
posted Mar 2, 2015 by Anamika

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

The WHERE clause filters on individual rows (before they are passed to the aggregate) and the HAVING clause filters on the aggregated values. It might look something like this:

select country, count(*)  
from forum_brick 
where username is not null 
group by country 
HAVING count(*) > 10 
order by count(*) DESC
answer Mar 3, 2015 by Salil Agrawal
Similar Questions
+4 votes

Table Name : Hist_table

 Shp_cd wt_grp  net_wt  tot_wt
   101   10       9      7
   102   20       8      2
   103   15       4      1

Factor_table

Fact_id fact_column factor
  1     wt_grp        2
  2     net_wt        5
  3     tot_wt        3

Note – this factor table contains rows as the column name of hist_table.
Now we have to update the Hist_table with the multiplied with the factors
For example wt_grp factor is 2 then we have to update all the wt_grp column of hist table as Hist_table.wt_grp * factor_table.factor
So the result should be

shpcd   wt_grp  net_wt  tot_wt
101     20        45    21
102     40        40    6
103     30        20    3
+1 vote

In my table I have three unique column this can be referred by other table.
Which key I have to use for this.

+1 vote

I wanted to avoid push if any of the files is deleted from the local git clone area. Can anyone please help me with that?

I am using Stash for repository management.

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...