If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > please tell me

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-14-10, 15:34
remshad remshad is offline
Registered User
 
Join Date: Jun 2010
Posts: 3
please tell me

please tell me how to i make a sql query for
selecting data's from a table where that data repeated 4 times in that column
Reply With Quote
  #2 (permalink)  
Old 06-14-10, 16:19
dav1mo dav1mo is offline
Registered User
 
Join Date: Dec 2007
Location: Richmond, VA
Posts: 782
how about a bit more info? Your question is rather vague. Try showing what data you have and what you would like to see as output.
Dave
Reply With Quote
  #3 (permalink)  
Old 06-14-10, 16:23
remshad remshad is offline
Registered User
 
Join Date: Jun 2010
Posts: 3
i have a table named department and the columns are dep_id dep_name ...etc

i want to select datas from field(coulmn) where which is repeated 4 times or more


for eg: if department ids (dep_id) are mech,computer,civil

and if in column dep_id mech data repeated 6 times
and in column dep_id data computer repeated 2 times
and in column dep_id data civil repeated 3 times


i want a sql query to select data mech from the column dep_id (bcz the data mech repeated 6 times ie more than 4)
Reply With Quote
  #4 (permalink)  
Old 06-14-10, 16:28
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,606
Code:
SELECT dep_id
   FROM t
   GROUP BY dep_id
   HAVING 4 <= Count(*);
-PatP
__________________
In theory, theory and practice are identical. In practice, theory and practice are unrelated.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On