Posts

oracle - Doing a calculation in sql without sum -

Image
i have table generated sql using inner join, want calculate total cost of each order_id, example screen shot shows 4 orders order id 127, want combine total costs of each ordered item 127 1 number, same other order ids. price in table haven't specified in query. i thinking of doing quantity* price, not sure how link order ids i've mentioned above. many help:) sql: select p.carrier_id, o.aircraft_id, o.order_id, o.quantity orderline o inner join purchaseorder p on o.order_id = p.order_id; my results far: you want use group by . need know rest of query give complete version, - roughly: select p.carrier_id, o.aircraft_id, o.order_id, sum(o.quantity) -- columns orderline o inner join purchaseorder p on o.order_id = p.order_id -- tables , join group p.carrier_id, o.aircraft_id, o.order_id; you might think need group order id, rule of thumb "group you're not counting (or summing...) also, pointed out other answer, if have record of prices, ...

Clojure: Require png-extract doesnt work with []'s? -

why work: (ns image-test.core (:gen-class) (:require (png-extract) [clojure.string :as string])) but fails: (ns image-test.core (:gen-class) (:require [png-extract :as png] [clojure.string :as string])) i thought [] ok in require. please edify. (:require (png-extract)) no-op, "succeeding" doing nothing. using parens here means you're starting prefix list, (:require (clojure set string)) require clojure.set , clojure.string ; since don't put namespaces after png-extract , it's not requiring @ all. using [] s correct, it's failing because there's wrong png-extract namespace: perhaps doesn't exist, or broken in way.

java - Big Decimal while loop -

i had while loop used integer converted big decimal since the value high , i'm unsure of how make while loop work big decimal instead of integer code follows. public string getsize() { bigdecimal size = new bigdecimal(mysize); int count = 0; string datatype = ""; while (size > 1000 ) { size = size.divide(size, 1000); count++; } switch (count) { case 0: datatype = "bytes"; break; case 1: datatype = "kb"; break; case 2: datatype = "mb"; break; case 3: datatype = "gb"; break; case 4: datatype = "kb"; break; } return size + datatype ; } the error @ line while (size > 1000 ) since method if size integer. can tell me method using big decimal size? i've had trouble coming it edit: solutions given , unrelated problem popped in division line im getting: "exception in thread "main" java.lang.illegalar...

Drupal 7 multi-site install -

i have 2 domains , 1 sub-domain on single virtual host (web hosting company). have ssh access , can create symbolic links. question is: would matter of me creating symbolic link , copying files virtual host path , (if so) files need copied directory make work? for example: 3 domains example.com example2.com demo.example.com drupal installed on example.com . in /sites directory there 4 directories: all example.com example2.com demo.example.com example2.com , demo.example.com symbolic links actual paths on system. copying files these directories such settings.php , install.php , etc. a typical drupal install designed host multiple domains using same code base, in hosting provider point 3 domains same directory root of drupal install , not sites directory of drupal. if drupal file in example.com create symbolic link point exmaple2.com folder example.com's domain directory. in within example.com directory go sites folder , create example2.com fo...

windows - trying to get absolute file path's from relative path's from CLI -

cd "c:\path\to\directory\" >nul & echo %cd% say run in c:\dir . i'd expect output c:\path\to\directory since that's if run each command individually , in succession. doesn't that. when 2 commands sorta concatenated outputs current path - eg. c:\dir . any ideas why? alternatively, ideas how can full path relative path via cli? if concenate 2 commands act code block , %variables% can't change value. have use delayed expansion: @echo off & setlocal enabledelayedexpansion cd "c:\path\to\directory\" >nul & echo !cd! output be: c:\path\to\directory

xcode - iOS app crashing every other launch, can't find error -

first time launch app, seems run fine. i'll hit stop button, work , when go launch again, seems crash before can load anything. press stop, hit run again, , works fine. until repeat process. this xcode highlighting error "thread 1:signal sigabrt". nothing useful here. int main(int argc, char *argv[]) { @autoreleasepool { return uiapplicationmain(argc, argv, nil, nsstringfromclass([pokerappdelegate class])); } } the debug console shows nothing besides (lldb) (so suppose stopping, not crashing @ point) so, when perform bt get: (lldb) bt * thread #1: tid = 0x1c03, 0x9a258a6a libsystem_kernel.dylib`__pthread_kill + 10, stop reason = signal sigabrt frame #0: 0x9a258a6a libsystem_kernel.dylib`__pthread_kill + 10 frame #1: 0x99ea1b2f libsystem_c.dylib`pthread_kill + 101 frame #2: 0x04a7057b libsystem_sim_c.dylib`abort + 140 frame #3: 0x01dc0b4e graphicsservices`gsregisterpurplenamedport + 348 frame #4: 0x01dc069f graphicsservice...

sql - Why won't my master table column increment in my trigger? -

i need create trigger keep track of number of times movie rented business blockbuster. need separate trigger insert, delete , update. the column tracks number of times rented called num_rentals , has datatype of int. column part of movies table has *movie_id (pk*), movie_title, release_year, movie_description, , num_rentals. customer_rentals table has item_rental_id(pk), *movie_id(fk*), customer_id. i searched , found similar thread here , tried using supplied answer, no avail. executed following string without errors saw no change in num_rentals column when inserted data either movie or customer_rentals table. doing wrong? create trigger dbo.tr_num_rented_insert on dbo.customer_rentals insert begin update m set num_rentals = num_rentals + 1 dbo.movies m inner join inserted on m.movie_id = i.movie_id ; end i added num_rentals field table later , need know how initialize field value 0 records in movies t...