Jump to content
php.lv forumi

Select by count


jupper

Recommended Posts

Ar šo es varu atlasīt pirkumus pēc to biežuma:

Select count(*) as total_count, id,email from orders group by email order by total_count desc

 

Viss strādā. Bet man NEVAJAG atlasīt visus ierakstus, man vajag tikai tos, kas ir veikuši pirkumus vairāk kā divas reizes. Selects varētu būt šāds, bet nestrādā:

Select count(*) as total_count, id,email from orders where total_count>'2' group by email order by total_count desc

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...