Re: [PHP-DB] Why the sudden dis-interest?

2012-09-21 Thread Rikin Parekh
I am happy with this community. I get a lot of new things to learn daily.

On Fri, Sep 21, 2012 at 10:07 AM, Jim Giner jim.gi...@albanyhandball.comwrote:

 What's with all the people suddenly wanting to unsubscribe?  Did they
 suddenly become experts - no longer needing the community for support? Or
 did they suddenly discover they had actually enlisted for the influx of
 emails they were getting and wanted to stop them?  Sure seems odd

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Need help with SQL Query

2012-04-13 Thread Rikin Parekh
Suppose I have a *BOOKS* table like the one given below:

 ISBN   |  Book Title  |  Author Name

  1   Jungle bookSam
  2   Princess Diary  Joe
  3   Titanic  Sam
  4   House  Joe
  5   Scary Movie Rick
  6   Wonders  Harry
  7   Java   Rick


I am trying to write a query which will give the *total number of book
titles written by each author*. The final result should be like

Author NameCount
  Sam2
  joe   2
  Rick2
  Harry  1

Can someone help me with this ?? I have tried

Select Author Name, COUNT(Book_Title) as Count
From Books
Group By (Author Name)

Will this above query work fine and give the results as shown?

Thank you in advance

Rikin


Re: [PHP-DB] Re: Need help with SQL Query

2012-04-13 Thread Rikin Parekh
This is the sample data provided to me. I need to query this data only. And 
column name can be without spaces. I need to know the query that will give me 
the result irrespective of the syntax errors in question table. Can someone 
please guide or help?

Thanks,
Rikin

On Apr 13, 2012, at 9:12, Jim Giner jim.gi...@albanyhandball.com wrote:

 why don't you try it and see?  (altho I suspect that using 'count' as the 
 result field name might not work, and that having column names with spaces 
 in them will require quotes around them.)
 Rikin Parekh riki...@gmail.com wrote in message 
 news:CALbBjtc3S51Wm=GfZz6_mUW08iRfTC1v=mrzhqru3hx__u2...@mail.gmail.com...
 Suppose I have a *BOOKS* table like the one given below:
 
ISBN   |  Book Title  |  Author Name
 
 1   Jungle bookSam
 2   Princess Diary  Joe
 3   Titanic  Sam
 4   House  Joe
 5   Scary Movie Rick
 6   Wonders  Harry
 7   Java   Rick
 
 
 I am trying to write a query which will give the *total number of book
 titles written by each author*. The final result should be like
 
 Author NameCount
 Sam2
 joe   2
 Rick2
 Harry  1
 
 Can someone help me with this ?? I have tried
 
 Select Author Name, COUNT(Book_Title) as Count
 From Books
 Group By (Author Name)
 
 Will this above query work fine and give the results as shown?
 
 Thank you in advance
 
 Rikin
 
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Re: Need help with SQL Query

2012-04-13 Thread Rikin Parekh
I got the answer. My query works perfectly fine. Earlier I had problems in
configuring mySQL Workbench so I could not try.

Thank you guys.

Rikin

On Fri, Apr 13, 2012 at 10:28 AM, Jim Giner jim.gi...@albanyhandball.comwrote:


 Rikin Parekh riki...@gmail.com wrote in message
 news:fad9d02d-2add-4a31-b118-81d56183e...@gmail.com...
 This is the sample data provided to me. I need to query this data only. And
 column name can be without spaces. I need to know the query that will give
 me the result irrespective of the syntax errors in question table. Can
 someone please guide or help?

 Thanks,
 Rikin
 it looks like it will do what you want.  I don't know why you are asking
 instead of trying it out.  :)



 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Flow of PHP testClass

2012-03-29 Thread Rikin Parekh
Hi Guys,

Given below is a PHP script. Can someone help me with the output of the
code. According to my understanding the output should be 3, 50, 20, 10. Can
someone elaborate on the same and provide me an explanation on the flow?

Thanks a lot in advance.

?php
class TestClass {
var $a =20;
var $b =10;
function TestClass($a= null, $b=null) {
 if (!is_null($a))
 {
   $this-­‐a= $a;
 }
if(!is_null($b))
 {
 $this-­‐b=$b;
 }
}

function printAB() {
echo $this-­‐a.” “.$this-­‐b.”\n”;
 }
}

$inst1 = new TestClass(3,50);
$inst2 = new TestClass();
$inst1-­‐printAB();
$inst2-­‐printAB();
?