@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3



Comments:

<0> hey guys, im using postgres,
<0> i want to know how to know which value is repeated the most in a column,
<0> for example in a table of people, that tracks their name and their age, i would like to know what age is the most common
<1> isnt that the mean?
<2> hmm
<2> i guess you could find help on those engines
<2> not bad
<3> I thought that was the Mode
<1> im pretty sure postgres has a function for it
<3> Either that or group by the age, count records order by count desc and nab the first record.
<0> i would think so, CoJoNEsX, what is it called in other db systems? i cant seem to find it
<0> Halo_Four thats a good idea, i was in the middle of writing a function for it, when i realized there has to be better way
<4> the most common age would be the age with the highet COUNT, surely
<1> doesnt seem to exist
<1> this should help though http://www.builderau.com.au/architect/database/soa/Build_upon_SQL_s_built_in_statistical_functions/0,39024547,39130334,00.htm
<1> and Halo_Four was right :(



<1> again
<3> pgres lets you write custom aggregates tho, don't it?
<1> yes
<5> heh, wtf? mighty late for that macro to take effect :P
<1> ?
<6> i've ran SQL2000-KB884525-SP4-x86-ENU.EXE twice on a MS SQL 2000 server but it won't upgrade to SP4, still says 8.00.194 instead of 2039
<1> thats unfortunate.
<6> isn't it?
<4> tried a third time ?
<6> ;0
<6> zzzzzzzzzzz
<7> I've got a query throwing an error in QA but not EM. Why would this occur? http://sql-servers.com/nopaste/?show=156
<7> SQL 2000 SP4
<6> seriously, any thoughts? should i try sp3 first?
<7> compi: You've stopped the process and restarted (and closed EM and reopened) just to be sure?
<6> yes. i'll try again
<4> yes try sp3 first
<7> Also, where are you getting the version from (code or EM)?
<4> if all else fails
<6> code
<6> restarted sql and agent and same thing
<6> 8.00.194
<7> Any chance you're running more than one instance and upgraded one and not the other (general confusion)?
<6> its possible. let me confirm
<2> halo, if in a timer i am iterating an array list and just doing stuff to the items. if the arraylist gets added to from another member function, is it gonna cause trouble?
<2> (added while i am iterating through it)
<5> is the timer and the "another member function" executing on different threads?
<6> bingo
<6> thanks guys
<8> MSSQL: I have a table that has an identity field -- I want to create a new table, and then move the data from my old table to my new one, but maintain that identity field's value, and also have the field in the new table also be an identity field.. is this possible ?
<5> make the column in the new table an identity field after filling it with the rows from the old table
<8> That's possible ?
<8> ok
<9> livesNbox : yes - look up 'identity_insert' or 'insert_identity' - can't remember which way round
<5> yeah, there's also a hint for the insert to manage this I think
<8> I see Bulk Insert with a KEEPIDENTITY argument
<8> looks like it's overall doable..
<8> so that's good :)
<9> livesNbox : set it to 'on', then you can insert values into an identity column using insert into/select
<8> i gotcha..
<8> thanks guys :)
<8> see ya
<9> in fact, if you try the insert without doing that, it'll tell you that you need to do it...
<8> hehe.. excellent.
<9> including the right name for the pseudo-variable
<10> I have a birthdate stored with a two digit year, say 01-01-56, and it's showing as 2056 instead of 1956. When I try to calculate sysdate-birthdate, this is obviously an issue. Any suggestions on how to correct this in a query without changing the data?
<3> Which RDBMS?
<10> oracle 9i
<3> I would imagine that Oracle has a setting which specifies the cutoff value for 20xx or 19xx
<1> nope
<1> you can write your own functin for that
<10> i heard there is something you can do intra-query
<10> is there a way to subtract 1000 years inside a query?
<10> like, instead of sysdate-dob, do a sysdate-(dob-1000 years)
<3> Probably. You're going to want to move to 4 digit years, though.
<10> well it isn't my call unfortunately
<10> How can you subtract 1000 years?
<11> were these people not around 7 years ago? 2 year dates?
<11> Fizzter : dateadd()
<11> "2 year dates" should read "2 digit years"... sheesh
<5> how did you "store" that date?



<5> what data type I mean
<2> LVK: timer is obviously executing on a separate thread......it's a timer....
<1> varchar im sure
<5> Quant: in winforms in .net there is a message based timer, hence the question
<3> Depends on the timer.
<5> Quant: but yes, on different threads it will be a problem
<11> Quant : that's not obvious at all
<11> timer kicks on the main thread by default
<2> no, timer is on a separate thread
<2> by default
<5> depends on the time type :)
<3> Depends on the timer. There are three of them.
<2> the regular windows timer man
<5> you mean: System.Regular.Windows.Timer ?
<2> hehe
<2> everyone is trying to show how smart they are :)
<10> it's giving me dateadd() - invalid identifier errors with that
<5> in any case, if you're enumerating the collection in one thread, and adding to it in another, I'd expect an exception being thrown in the first thread
<11> the code triggered by the timer runs in the same thread as that which invoked the timer
<2> gunther: obviously not
<11> why obviously?
<2> that's not the way it works
<10> shouldn't I be able to do trunc((sysdate - DateADD('yyyy', -1000, dob))/365.24) AS "Age" ?
<2> System.Timers.Timer
<11> really? how does it work then? it'll create a new thred to execute the event code?
<5> Fizzter: what data type is "dob" ?
<5> GuntherX: it depends on the timer cl***
<10> it's the column name
<2> The server-based Timer is designed for use with worker threads in a multithreaded environment. Server timers can move among threads to handle the raised Elapsed event, resulting in more accuracy than Windows timers in raising the event on time. For more information on server-based timers, see Introduction to Server-Based Timers.
<11> Fizzter : don't forget that there are two calendar changes you need to consider
<5> right... but what is the data type of that column?
<10> should be a date
<10> let me check
<11> switch to gregorian in 14th century
<10> yeah it's a date
<5> and this is what database engine?
<11> so just subtracting 1000 years is not going to be accurate
<10> hmm
<11> Quant : *can* move amoung thread
<11> Quant : they're not gonna do the threading for you
<12> select distinct email_id from kat_email where kat_id in (1,2,7) . hey, i am doing this. my problem is, i want only the email_ids that contain all of (1,2,7). not the ones that contain one,some or all of them. tnx a lot
<2> :(
<2> dude each even is spwned on a diff thread
<5> Ron: for each row, kat_id can only be one of those values
<2> event
<11> as you wish
<12> LVK: what would i do to get the expected result set?
<5> Ron: I don't know what your expected result set is
<5> Ron: does the table contain email_id multiple times, once for each kat_id?
<5> ie. 1, 1 - 1, 2 - 1, 7 ?
<12> yes
<5> SELECT ... WHERE EXISTS (... WHERE kat_id = 1) AND EXISTS (... = 2) AND EXISTS (... = 7)
<13> in a stored procedure (mssql), i have the following statement
<12> and i want all email_id's that have rows with kat_id 1 AND 2 AND 7 not with 1 OR 2 OR 7
<11> Ron : in() does an OR, you need AND - so write lots on AND clauses
<13> select @tempstr = 'value = ' + @var1
<11> s/on/of
<13> where @var1 is an integer
<13> how do i make this work?
<5> you can do a trick though
<11> tapped : use convert() or cast()
<13> select @tempstr = 'value = ' + cast(@var1 as varchar(5))?
<11> tapped : did it work?
<13> no, it didn't display anything
<5> SELECT DISTINCT email_id FROM kat_email WHERE (SELECT COUNT(DISTINCT kat_id) FROM kat_email WHERE kat_id IN (1, 2, 7)) = 3
<13> convert?
<11> tapped : it won't display anything, dummy
<5> SELECT DISTINCT email_id FROM kat_email AS KE1 WHERE (SELECT COUNT(DISTINCT kat_id) FROM kat_email AS KE2 WHERE kat_id IN (1, 2, 7) AND KE1.email_id = KE2.email_id) = 3
<12> wow, thanks a lot. i am just starting with sql so these things puzzle me often.
<12> thanks for the help
<5> that should be the right one
<11> tapped : you're ***igning a value to a variable, not returning data
<13> Gunther, when im display the value smart ***
<5> but it depends on the database engine and the version


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #sql
or
Go to some related logs:

ProbaGate torrent
Request for the permission of type 'System.Net.WebPermission, System, Version=2
#photoshop
#politics
#winvista
¨TOTTI AGAME'¨''
#windows
#python
#stocks
#computers



Home  |  disclaimer  |  contact  |  submit quotes