Jump to content


Photo

Somar valores da coluna do banco de dados

Soma Php Bd Banco de Dados Coluna

  • Faça o login para participar
6 replies to this topic

#1 bobsap

bobsap

    Normal

  • Usuários
  • 82 posts
  • Sexo:Masculino
  • Localidade:marilia

Posted 04/06/2015, 14:12

Estou fazendo um sistema de relatórios e no banco irá ter, por exemplo:

> - visualizacoes | 300
> - clicks | 20
> - data | 2015-06-03

> - visualizacoes | 230
> - clicks | 3
> - data | 2015-06-03

> - visualizacoes | 340
> - clicks | 10
> - data | 2015-07-01

Então meu problema é, que vai ter 2 registros ou mais a data (Mẽs) igual, como no exemplo acima que tem dois com o mês 06. Preciso somar os clicks e visualizacoes do mesmo mês e exibir 1 resultado só (já somado) na query.

Tenho o código

$relatorios = $this->db->query("SELECT visualizacoes, clicks, MONTH(data) AS mes FROM relatorio WHERE YEAR(data) = '".date('Y')."' ORDER BY data ASC");

Mas esse só está organizando para fazer o relatório do ano atual, mas não tenho noção como colocar algo pra somar o mesmo mês.



#2 Danilomaru

Danilomaru

    Ativo

  • Moderadores
  • 300 posts
  • Sexo:Masculino
  • Localidade:brasil

Posted 07/06/2015, 19:43

SELECT
SUM(visualizacoes),
SUM(clicks),
MONTH(data) AS mes
FROM relatorio
WHERE YEAR(data) = '2015'
GROUP BY mes
ORDER BY mes ASC

SQL Fiddle aqui.



#3 HaroNism

HaroNism

    Super Veterano

  • Usuários
  • 15385 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 23/10/2017, 23:29

Viagra American Express Is Cephalexin A Sulfa Drug Propecia Medimecum viagra prescription Purchase Cialis 5mg Amoxicillin Cystitis
Keflex Staphylococcus Furuncle Bestellen Viagra 100mg viagra Akitas Keflex Side Affects Of Cephalexin Viagra Indien Bestellt

#4 qapedlok

qapedlok

    Expert

  • Usuários
  • 509 posts
  • Sexo:Feminino
  • Localidade:Worcester

Posted 24/10/2017, 05:02

Discounts! product page web design progect11.jpg Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked! If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included). buy.png READ MORE York - Tan Calf Leather Belt ( 110.00 $)MuzaFonmor 2016 new men's bags cowhide leather shoulder bag multiple zipper leisure bag man cross body travel bags ( 39.81 $)Harajuku 2016 T Shirt Women Tops Punk cute but psycho Letter Print Tee Shirt Femme T-shirt Casual tshirt O-neck rock Tumblr XL ( 6.13 $)7a grade malaysian virgin hair body wave 4pcs per lot human hai100g3.5oz wholesale customized 8-30 inches remy body wave ( 61.00 $)Simplee winter off shoulder knitted bodycon dress women long sleeve autumn sexy dress 2016 party short white dresses vestidos ( 24.65 $)Boat gray canvas espadrillas ( 141.76 $) DSquared2Sorvino, MiraNew 2016 Bamboo Sunglasses Men Wooden glasses Women Brand Designer Original Wood Sun Glasses fo WomenMen Oculos de sol masculin ( 4.83 $)Pembury whip stitch black suede ankle boot ( 232.70 $) McQ Alexander McQueenGeorgia Mini Three Hand Sand Leather Womens Watch ( 109.00 $)2pcs 10w led car fog light lamp round headlight spotlight for car motorcycle waterproof drl daytime running lights white ( 21.24 $)Vernee Thor 4G Smartphone ( 99.99 $)Rhinestones Clear Transparent TPU Plating diamond Case For Samsung Galaxy A3 A5 A7 2016 A8 A9 J3 J5 J7 S6 S7 S6 S7 Edge S6 Plus ( 3.99 $)Lumiere Blue Enamel Brass Cufflinks ( 110.00 $) 71.jpg
Discounts! hair styling products for men

progect11.jpg
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).

buy.png

READ MORE
DOOGEE X6 Pro 4G Phablet-98.22 $
2x White Red Blue yellow 18mm 9w DC 12V Led Eagle Eye Light Daytime Running Drl Backup Car Motor Parking Signal Lamps Waterproof ( 2.29 $)
Shein autumn womens new fashion coffee lapel long sleeve trench coat ladies open front tie waist casual long outerwear coats ( 34.49 $)
Ali lowest price guaranteed color fashion nail polish soak off led uv gel color hot nail ( 0.64 $)
Solar power bank powerbank charger 12000 mah battery universal portable power bank high-capacity external sun solar charger ( 29.99 $)
Ulefone Power 6050mAh Android 6.0 5.5 inch 4G Phablet FHD 2.5D Screen MTK6753 64bit Octa Core 1.3GHz Fingerprint Scanner 3GB RAM 16GB ROM 5.0MP + 13.0MP Cameras 168.59$
1x Car led HB4 9006 33 LED 5630 SMD White Car Auto Light Source Fog DRL Daytime Running Driving Lamp Bulb Daytime Running Light ( 3.99 $)
8pcsset Russian Kid toys Patrol Dog Patrulla Canina Toys Everest,Ryder,Skye,Chase Vehicle Car Spain Patrol Canine ( 45.68 $)
Cheap good quality fluffy long wig heat resistant synthetic wigs natural curly hair harajuku brown wig ombre wigs cosplay peruca ( 23.98 $)
Casual black small chains totes shell handbags hotsale women evening clutch ladies purse famous designer shoulder crossbody bags ( 27.90 $)
Hot selling 1 pcs adjustable wardrobe drawer divider storage retractable clapboard for ties socks bra underwear ( 2.72 $)
ideaBee Hot Envelope Women Wallet Color 3Fold Flowers Printing 5Colors PU Leather Wallet Long Ladies Clutch Coin Purse Womenbag ( 6.56 $)
Papaya 1 Light Blue Murano Glass Earrings ( 45.00 $)
Vesennyaya uborka v Moskve nachalas ranshe obichnogo
8a bloomy hair brazilian straight virgin hair 34 bundles deal brazilian virgin hair straight human hair weaves extensions ( 60.00 $)


192.jpg
Discounts! best new makeup brands

progect11.jpg
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).

buy.png

READ MORE
24K Carat Gold Foil Plated Poker Game Playing Cards Gift Collection +Certificate ( 9.00 $)
Hot sale 2016 Cats Printing women Handbags Shell bag women PU leather messenger bags new arrival women cross-body bags WLHB1116 ( 47.77 $)
Camera Lens Alarm Clock Calendar with Music and Starry Sky Projection-12.02 $
Yvonne afro kinky clip in extensions natural hair,100% brazilian virgin hair clip in human hair extensions,7pcsset,color 1b ( 54.70 $)
Brazilian virgin hair body wave 4 bundles brazilian body wave human hair mink brazilian hair weave bundles remy human hair ( 74.68 $)
Hot sale fashion luxury women engagement jewelry 925 sterling silver 5a zc crystal zircon female wedding finger flower rings ( 99.00 $)
Arnagar Brand Genuine Leather women messenger bags fashion designer solid flap pocket women's handbags sac a main ( 53.70 $)
Wood case for samsung galaxy s5 s6 s7 edge plus note 5 4 3 bamboo carving 100% natural phone case for iphone 5 5s se 6 6s 7 plus ( 16.99 $)
Deluxe Motomo Aluminum Metal Brush Hard Back Cover Case for Samsung Galaxy J1 J3 J5 J7 A3 A5 A7 A8 A9 2016 E5 E7 Z1 On5 On7 ( 1.68 $)
LeTV Leeco Le Pro 3 X720 4G Phablet-409.00 $
6A Brazilian Deep Curly Virgin Hair 4Pcs Unprocessed Brazilian Virgin Hair Curly Human Hair Extensions Cheap Brazilian Deep Wave ( 84.93 $)
2pcs Acrylic Spiral Taper Tunnel Ear Stretcher Plugs Expanders Body Jewelry Drop Ship tragus ear plugs flesh tunnel Piercing ( 1.86 $)
2016 New Natural Black Lava Stone Bracelets 7 Reiki Chakra Healing Balance Beads Bracelet for Men Women Stretch Yoga Jewelry ( 2.55 $)
Chimera green suede and fabric sneaker ( 121.32 $) D Acquasparta
NEW Baby Flannel Set Winter Girl boy Cartoon animal Suit Super Thick Warm Coat+Pants+Clothing (Three Piece Sets)Velvet Clothes ( 28.77 $)


32bb.jpg
Discounts! must have products

progect11.jpg
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).

buy.png

READ MORE
Xiaomi Redmi Pro 32GB 4G Phablet-262.37 $
Casual black small chains totes shell handbags hotsale women evening clutch ladies purse famous designer shoulder crossbody bags ( 27.90 $)
8000-10000 Meters ! Long distance 532nm Green 303 Laser Sight Rifle Scope Riflescope Laser Pointer With 18650 Batteries Charger ( 17.98 $)
Merkuri, Melina
JXD 509G 6 Axis Gyro 5.8G Real-time FPV 4CH One Key to Return RC Quadcopter with 2.0MP Camera 89.39$
Winter jacket women large fur collar hooded jacket thick coat for women outwear parkacoatscasacos de inverno feminino ( 35.00 $)
POSLEDNIJ GUDOK
Momaha - shop fashion clothes from leather and fur in Tomsk. Fur coats, sheepskin coats, leather jackets, down jackets, coats and accessories at the official online store MosMexa.ru
Fashionable peep toe and platform design women's sandals ( 32.79 $)
Lord Snou
Mink Brazilian Virgin Hair Straight 4Bundle Deals Unprocessed Virgin Brazilian Straight Hair Extension 7A Remy Human Hair Weave ( 73.25 $)
Pink metallic leather wallet on chain ( 168.50 $) Kenzo
OGURCI KONSERVIROVANNIE
Original ASUS Zenfone Pegasus 3 X008 32GB16GB ROM 5.2 ( 238.45 $)
Brazilian Virgin Hair Body Wave 6''-28'' Mink Brazilian Body Wave 3 Bundles Ombre Brazilian Hair Weave Bundles Remy Human Hair ( 45.00 $)


41bb.jpg

#5 RonsisM

RonsisM

    Super Veterano

  • Usuários
  • 15724 posts
  • Sexo:Masculino
  • Localidade:Plovdiv

Posted 24/10/2017, 18:16

Levitra Cialis Viagra Diferencias 1286 Avanafil Cost Acheter Du Cialis 10mg viagra Noprescriptiondrugs Viagra Efectos Secundarios Jovenes
Prix Du Viagra Is Amoxicillin Safe In Pregnancy generic viagra Priligy Ervaringen Viagra Achat Kamagra
Keflex To Treat Spodylitis Levitra Quale Dosaggio cheap vardenafil 20mg Canadian Viagra 400mg
Fish Flex Forte 500 Mg Cephalexin viagra online Viagra Senza Ricetta Medica Viagra Acheter En Ligne France Levitra Generic India
Dramamine Buy Australia levitra 20mg best price Cialis 20 Generique Levitra Prostatite Cephalexin And Ledum
Article Baclofene Zithromax Patient Education Zentel 400mg Can I Purchase viagra Where To Buy Provera And Clomid Online Periactin Amazon Propecia Cure Shedding
Achat Cialis 20mg Original Dove Acquistare Cialis Line Dapoxetine Buy cialis Erection Pills For Sale Levitra Generico Online Vendita
Viagra E Fecondazione Propiedades Propecia levitra vs viagra vs cialis Meds Similar To Doxycycline Strattera 18 Generic Viagra Fedex
Priligy Torrino viagra PiРÑвâžâ Cialis Kamagra
Buying Seroxat On Line Buy Cipro 500mg online pharmacy Zithromax Greenstone Prednisone No Script Canadian
Buying Medicaltion Online cialis buy online Online Us Pharmacy
Keflex Breast Cyst Olympic China Vardinafil viagra Review Best Place To Buy Viagra Online

#6 uapedlok

uapedlok

    24 Horas

  • Usuários
  • 414 posts
  • Sexo:Masculino
  • Localidade:Vladivostok

Posted 25/10/2017, 13:58

Discounts! best products co inc

progect12.jpg
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).

buy.png

READ MORE
Original 2016 brand women's winter jacket plus size slim fashion stand lantern sleeved long blue skirt parka women wholesale ( 109.75 $)
New original fashion orange top high quality luxury lock designer handbags famous brand real women bag evening bags totes fr028 ( 112.19 $)
Windows Firewall Control 4.9.4.0
Roskosmetika - Internet shop of professional cosmetics. To buy natural cosmetics in Moscow and St. Petersburg
«I bil oktyabr. I bil aprel…»
3 bundles brazilian virgin hair water wave virgin hair wet and wavy human hair bundles mink brazilian hair weave bundles osa ( 50.00 $)
Grade 7a Virgin Brazilian Kinky Straight Hair Bundles Deal Cheap Brazilian Hair 1 pcs lot Free Shipping 100g Yaki Human Hair ( 15.08 $)
Princ Vinterfella
5.5 inch blackview e7s smartphone mt6580 quad core 2gb 16gb 1280x720 mobile phone android 6.0 fingerprint 8.0mp unlocked phone ( 69.99 $)
Geneva Bright Colors Leather Band Ladies Fashion Quartz Watch ( $3.41 )
Kirk, Brajan
Meilan Smart Bicycle Rear Light Bike Tail LED Light Shock And Daylight Sensor switch 7 Flash Model USB Bicycle Accessories ( 41.99 $)
Touchbeauty face cleanser 3 in1 heads & facial cleansing brush tb-0525a ( 39.98 $)
Women messenger bags famous brand handbags 2016 winter luxury vintage fashion v female small chain crossbody bags for women 01 ( 27.99 $)
7 inch touch monitor video intercom door phone doorbell 900tvl hd camera ir night vision wired door bell phone ( 128.34 $)


55bb.jpg

#7 HaroNism

HaroNism

    Super Veterano

  • Usuários
  • 15385 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 25/10/2017, 18:18

Propecia Farmacopea Viagra E Hipertension Pulmonar buy levitra 10 mg Zithromax And Birth Control Cialis Euros
Peut On Avoir Du Viagra Sans Ordonnance Kamagra 100 Mg Besancon Mexican Pharmacy cheapest levitra Stemigra Sildenafil Citrate 100mg Generique Priligy Dapoxetine 60mg Commander Baclofen 10mg
Priligy Precio En Espana viagra Buy Cheap Nexium Acheter Cialis Viagra Levitra





Veja alguns posts relacionados com: Soma, Php, Bd, Banco de Dados, Coluna

0 user(s) are reading this topic

0 membro(s), 0 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq