Programming :: MYSQL Select ORDER BY, GROUP BY Together?

Apr 19, 2010

I'm writing a PHP script, and I need a top 10 result from a mysql query.I've tryed like this:select IP,sum(download) from traf group by IP order by ASC limit 0,10and my sql returnsmysql> select IP,sum(download) from traf group by IP order by ASC limit 0, 10;ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ASC limit 0, 10' at line 1As I red through Google this is not quite supported by mysql, so is there another way to do this?

View 5 Replies


ADVERTISEMENT

Programming :: Duplicate Value In Select - Mysql Query ?

Dec 2, 2010

Trying to export a Mysql query to a .csv file the query draws from multiple tables, e.g. sales, purchase and currency

Code:

What i'm trying to do is to export both the sales and purchase to a single line where both the currency for the sales and the purchase is specified.

Basically like this:

Code:

Problem here is that i'm stating currency.value twice in the same select and don't know how to define which currency.value applies to sales and which to purchase.

View 7 Replies View Related

Programming :: Bash To Loop Through Mysql Select Array?

May 26, 2011

I need to know how to assign a result from a select. I am clueless on the sytax. I am trying this in bash. Maybe I am not assigning the array right. It gives me the whole row in the echo instead of just field a. How do I get fieldA = a in the select. Note script was stripped for security on database info but the syntax is same.

Code:

#!/bin/sh
results="$(mysql --user ${DB_USER} -p${DB_PWD} ${DB_NAME} -Bse 'select a,b,c,d from tblMytable')"
for rows in "${results[@]}"
do
fieldA=${rows[0]};
echo ${fieldA};
done

View 2 Replies View Related

Debian Programming :: MySQL PHP Insert / Update Fail - Select Succeeds

Nov 6, 2013

I have mysql installed successfully. I can insert rows into my table using phpMyAdmin. I can successful retrieve those rows in PHP with a select statement. However, I cannot insert or update rows from PHP. I get no error messages and everything appears to be working okay, just no results in mysql table.

View 0 Replies View Related

Ubuntu :: How To Select Boot Order In HDD

Jan 8, 2010

I'm getting a new HDD today. I have SATA 500GB, and I'm getting SATA II 500gb. This is what I wanted to ask. On my first HDD, I have Windows XP and ubuntu and on the new HDD, I will install Windows 7. What I wanted to ask, are such things like jumpers on my HDD (master/slave etc.) used to select boot order? Or will I have to go into BOOT settings and choose Win7 Hdd first in the boot order etc.?

View 2 Replies View Related

Ubuntu Installation :: 9.10 And Vista - How To Select Boot Order

Feb 28, 2010

I am using a dual boot with windows vista, I would rather use ubuntu but my wife wants windows. How do I change my boot order to boot into windows instead of ubuntu? My ubuntu is an upgraded version from 8.? then 9.04 then 9.10

View 7 Replies View Related

Programming :: Bash - Search For 1000 Then Assign Them Group 1 And Then 1001-1999 To Group 2

May 24, 2010

I have a text file that currently has around 150 000 usernames in it. I need to somehow group them into smaller groups of 1000 and then add that value into the DB. for example user xzy group 1 (hopefully the groups will be digits incrementing)

[Code]....

how to search for 1000 then assign them group 1 and then 1001-1999 to group 2 etc.

View 3 Replies View Related

Software :: [MySQL] Order By Custom Date?

Jun 30, 2011

I'm actually tryinng to order all by DATE on MySQL but seems not to be possible.The date order is like this for example: Wednesday, June 29, 2011, 18:31I tried with this, but doesn't work:SELECT * FROM members ORDER BY date ASCSometimes it works with DESC.And also with this, and same!SELECT * STR_TO_DATE( date, '%D, %M %d, %Y, %H:%M' ) AS date_for_sort FROM `members` ORDER BY date_for_sort;I have this problem and I need to fix it asap for the business.

View 2 Replies View Related

Server :: Stop Mysql In Order To Preform A Backup?

Apr 12, 2010

I'm working on an old redhat server with mysql installed and I need to find a way to stop the service in order to preform a backup.

some info that I found on the server code...

View 9 Replies View Related

Networking :: 2 Nics And Bonding - "select" The Right Path In Order To Reach The Radio Streaming

Aug 5, 2010

On my computer i have 1 network card and 1 USB modem for Mobile Internet. I can access internet using both devices, but when i am using the network card i am unable to listen to radio stations because the radio streaming is not allowed at the work place. So, i am triyng to find a solution and the solution seems to be to use the bonding module on linux. But i have a few question:

1) i don't know if it is possible to use this module for 2 such different devices
2) i don't know if, even enabling bonding, i will be able to "select" the right path in order to reach the radio streaming , or if the right path is selected automatically. When i connect to the radio station using the network card, it opens the connection, but it closes it imediately and i am not sure that the kernel is clever enough to use the other connection in this case.

View 2 Replies View Related

Ubuntu :: 9.1 - MySQL Listed As Group / Owner In Directory

Mar 23, 2010

I use 9.10 desktop with a root user and my own user (timmo), I did not create anything else. Now I check a directory (mysql databases) with ls -l and I see mysql not only as a group but also as owner. How can mysql, not being a user on my system, be an owner? In users and groups I see that all of the many groups only have two members, root and timmo. I know that mysql users and linux users are different animals but ls -l is definitely a linux command.

View 2 Replies View Related

Server :: MySQL Error 134 From Storage Engine Query: Select Data, Created, Headers?

Mar 1, 2011

I need help about the error in my website. I have the following error....

Code:
user warning: Got error 134 from storage engine query: SELECT data, created, headers, expire, serialized FROM cache WHERE cid = 'theme_registry:database1' in /var/www/html/web/includes/cache.inc on line 26.

View 2 Replies View Related

Programming :: Use Socket Programming In Order To Implement Chatting Feature?

Aug 25, 2010

how to use socket programming in order to implement chatting feature

View 5 Replies View Related

Programming :: Socket Programming Select Interface

Jan 15, 2010

I have currently had the need to go back to basic socket programming, and implemented a simple udp packet sender. But I realized I needed to be able to select which network interface to send the packets from.

The reason is so that one of the interfaces has vlan tagging, and I need my UDP packets to be accordingly vlan tagged. For example, one of the interfaces is eth1.200.

View 2 Replies View Related

Programming :: Haskell - I/O Not In Order?

Apr 18, 2011

I'm learning Haskell from an on-line tutorial, and trying to figure out how I/O works. I'm a bit confused with this example:

Code:

My expectation is for it to ask me for a line, then for it to convert the line I provide to uppercase (err... create a new line that is uppercase) and then output said line.

However, what actually happens when I run it is it firsts ask me for a line, then outputs "Next line: ", then outputs the uppercase line:

Code:

I realize that Haskell is not an imperative language, but I was (mistakenly?) under the impression that there was some kind of sequence guaranteed in the do blocks. Could someone explain why this happens, and how I can "fix" my code to get the desired behavior?

I'm running:
- Linux version 2.6.34-gentoo-r12 (64-bit)
- GNU bash, version 4.1.9(2)-release (x86_64-pc-linux-gnu)
- Glasgow Haskell Compiler, Version 6.12.3, for Haskell 98, stage 2 booted by GHC version 6.12.3

View 2 Replies View Related

Programming :: Replace A Value In Order?

Jul 26, 2011

I want to change the parameter for ThreadLimit for one file as shown below using sed. I want to ignore the commented line. But the command I am using also executing with commented line.

# ThreadLimit: maximum setting of ThreadsPerChild
ThreadLimit 25

I want the desired output as

# ThreadLimit: maximum setting of ThreadsPerChild
#ThreadLimit 25
ThreadLimit 50

For this I am using command.

sed '/ThreadLimit/{;h;s/^/#/p;x;s/ .*/ 50/;}' test.txt.1 > test.txt

View 7 Replies View Related

Programming :: Clarification In The Select System Call?

Dec 8, 2010

I have a process that forks, where the childs puts some data of random size and exits while the parent should get the data and does some manipulation.. here I have used a pipe for child to write the data and parent to read the data.. Child simply dumps the data, and the data is of any size even child and parent doesnt know.
I have used select in the parent to see whether there is any data coming on the reading end of the pipe.. if there is a data.. I copy into a buffer.. Im reading the data continusly when the child exits after closing the writing end of pipe. Parent gets blocked on the read part But my question is how parent know the other of pipe is closed when using the select call. In otherwords.. while using select in readfds, how would i know the other end has closed the pipe..

View 2 Replies View Related

Programming :: How To Create A Menu In C Like Bash's Select

May 23, 2011

Im wondering how to create a menu in c like bash's select. I imagine there is already something out but I don't know what it would be. Im a c newb but been scripting for a long time now and trying to pick up a little c.this would be what I am looking to display:

Code:

1) option 1
2) option 2
3) option 3

Make a selection:obviously 1,2,3 would be the only valid selection and anything else would say invalid or something like that.

View 2 Replies View Related

Programming :: Select The 3rd Element Of A Drop Down List?

Feb 9, 2011

I'm trying to make a very small script with greasemonkey to do some automatic things when a page loads. The first thing I need to do is to click on a link. I've done that. Then I need to select the 3rd element of a drop down list that appears a few moments (depending on the connection) after the link is pressed, without reloading the page (ajax or something like that). This I can't get to work, The select has no id or class, but I can get its xpath value. There is only one select on the page. I've tried both setTimeOut and the DOMNodeInserted event with no effect.

Code:
// ==UserScript==
// @name test
// @namespace "www.google.com"
// @include www.mywebpage.com
// ==/UserScript==

[Code]....

View 11 Replies View Related

Programming :: Korn - Combine Select With An Array?

Jun 8, 2010

Assume this array in Korn:

Code:
HOSTS[ home ]="163.164.165.166"
HOSTS[ work ]="122.123.124.125"

[code]....

View 3 Replies View Related

Programming :: Select The Branch Based On The INPUT?

May 23, 2011

I want to select the branch based on the INPUT. Here is the program segment which uses the case statement.

case $INPUT in

1)branch="Computer Science";;
2)branch ="Electrical";;
3)branch = "Mechanical";;
4)branch= "Aerospace";;
esac

When I run this script, I am getting an error, Electrical command not found?

View 2 Replies View Related

Programming :: Extracting Columns In Particular Order?

Jun 9, 2010

Say I have a text file with10 columns. I need to reorder them based on a list of column numbers that will reorder them.

My problem is this:

If I want to cut out 5 columns (columns 1,2,3,9,10) in the order 1,10,2,9,3 then I have tried using:

Code: cut -f1,10,2,9,3 my_file.txt > reordered_file.txt But this just extracts the columns in order as if I used:

Code: cut -f1,2,3,9,10 my_file.txt > reordered_file.txt How can I cut these columns and place them into the new file in the order I specify?

While this might seem quite trivial, I will actually need to do this for a file containing ~14000 columns with ~12000 columns that I need to extract in a particular order.

View 2 Replies View Related

Programming :: Error ""Can't Connect To Local MySQL Server Through Socket" In Connecting To MySQL In C Language

Sep 29, 2010

I wrote a code in C to connect to MySQL by using mysql_real_connect function but I recieved error "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)" (by using mysql_error function).

I also did the following things: in mysql I typed 'SHOW VARIABLES LIKE '%SOCKET%'', it returned /var/lib/mysql/mysql.sock I typed 'mysql_config --socket' in shell, it returned /var/lib/mysql/mysql.sock I modified /etc/my.cnf file

View 3 Replies View Related

Programming :: Select() Waking Up With Rd_set On A Not Yet Connected Socket

Jun 24, 2010

I'm facing a strange problem with our code. What the program does is to wait on a select() after a non-blocking connect. And I expect the select wake up with write_set after the ESTAB. And I expect select wakeup with both rd_set and wr_set if I recv a RST back for our SYN or any similar errors. But in one of the cases I'm seeing select is waking up with only rd_set in a non-connected sockeet, which is causing a lot of problems for me.

The code is organized such that the socket close() happens only in wr_set processing. Because of that with the above problem I'm going in to a strange scenario. After the event I call select() again and wait for another socket event. But with this issue, my select is waking up there after everytime as soon as I call select(). That too only with rd_set. So it keeps on going with select() sleeping 0 secs. Thus the program is hung and eating lot of CPU cycles also.

The trigger for all these problems seems to be some event which causes the waking up of select() with rd_set only. I tried many ways to find out what is happening with this. Couldn't find anything interesting yet.

View 1 Replies View Related

Programming :: Isolate Users From A Group?

Dec 5, 2010

how to isolate users from a group ie accounting and force them to change their password upon login

View 1 Replies View Related

Programming :: Get Group Name From GID Without Parsing /etc/groups?

Sep 14, 2010

Is there a Linux system call that can be used to get the group name from the GID returned by stat()? I realize that I could parse /etc/groups (if my user had sufficient permissions).

View 3 Replies View Related

Programming :: Reverse Bit Order In MIPS/SPIM?

Apr 27, 2009

Here is what I have so far.The program receives and echos characters without syscalls. I am trying to add 2 procedures(rev7 and putint)Rev7: Reverses the least significant 7 bits and outputs $s2Putint: Prints the decimal value of $s2.When i run it, it echos the character then prints a "P". I have no idea where that comes from.Everything seems correct to me but I do not understand why it does not print the decimal digits

Code:
.data
hello:.asciiz "Enjoy This Program

[code]....

View 2 Replies View Related

Programming :: Use Setsid In Order To Create A Daemon?

Apr 21, 2010

I would like to know if is it necessary(and why) to use setsid to create a session leader in order to create a daemon process?

View 1 Replies View Related

Programming :: SQLite Read, Write, Select, Compare Statements For C++

Jun 9, 2010

I am using C++ with SQLite db in a program that will read read a sub set of records, compare records and write different records to another database. I have a SQLite book, but it only shows examples for the C API. Anyone have code samples in C++ for the following:

Open database
Close
Select *
Read
Write

Or, just show me how to execute a SQL statement with C++ and I can then figure out the various SQL statements I need.

View 5 Replies View Related

Programming :: Select Options From Website To Initiate Download From Script

Nov 18, 2010

I usually use wget to download stuff from websites when scripting.I have a new requirement that requires me to authenticate then select some options to execute the download. How would I go about this? First thing that comes to mind is using keyboard macros in the Windoz world but I need to do this in bash or perl.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved