Jump to content

Search the Community

Showing results for tags 'sql'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 197 results

  1. Hi. Wonder if anyone can help. Am trying to retrieve records from my order table from a date inputted by the user. I've done all the SQL on my site up to here - this one is really baffling me through. Query: SELECT * FROM [order] WHERE orderDateTime LIKE '04/05/2012%'; However, it doesn't return any values - see my data types in my table below: As you can see from the data view there is data applicable in there to my query: Am at a loss. Can anyone help? Thanks. Kevin
  2. ibrahimjan

    CONCAT sql

    Hi All, I got this sql connection to my table wb, it all seems to work fine in phpmyadmin, when testing sql, but when i want to us it, it comes up with: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING inC:\----------\test3.php on line 75 line 75 is the $query_wb $query_wb = "SELECT CONCAT( "[", GROUP_CONCAT( CONCAT("{weID:'",`weID`,"'"), CONCAT(",weName:'",`weName`,"'}") ) ,"]") AS json FROM wb;"; any Ideas how to make it work??
  3. I have a table of orders. Each order has a status, one being "Shipped". The end goal is to take the data and push it into a chart showing total orders, shipped orders, and grouped by month/year. I can get the count of the orders and group them by month/year, but I'm not sure how to also include orders with the status of "Shipped". Any ideas? (The code I have now is counting the orders into a column called Orders and Shipped, but I know it's not actually grabbing shipped orders for the Shipped column. I just have it there for now so I could move on with populating a chart while I work on fixing the query.) SELECT COUNT(o.ROW_ID) AS Orders, COUNT(o2.ROW_ID) AS Shipped, RIGHT(CONVERT(VARCHAR(8), o.STATUS_DT, 3), 5) AS Date, MONTH(o.STATUS_DT) AS Month, YEAR(o.STATUS_DT) AS YearFROM dbo.S_ORDER AS o LEFT OUTER JOIN dbo.S_ORDER AS o2 ON o.ROW_ID = o2.ROW_IDWHERE (o.CREATED > CONVERT(DATETIME, '2011-04-01 00:00:00', 102)) AND (o.CREATED < CONVERT(DATETIME, '2012-05-1 00:00:00', 102))GROUP BY RIGHT(CONVERT(VARCHAR(8), o.STATUS_DT, 3), 5), MONTH(o.STATUS_DT), YEAR(o.STATUS_DT)ORDER BY Year, Month, Date DESC
  4. Mudsaf

    [PHP, SQL Question]

    Im wondering is it possible to make 2x connections in 1 page whitout getting error from other connection. (Whitout disabling errors on PHP.ini also.) My code so far this. <?php$local = mysql_connect('localhost', 'root', 'PASSWORD);if (!$local) {} else {mysql_select_db("DATABASE"); }$server = mysql_connect("HOSTSERVER", "USER", "PASS");if (!$server) {} else {mysql_select_db("DATABASE");}?> So my point is i want to create php that first tries to connect localhost, if it gets error and cannot connect it tries to connect to "HOSTSERVER". (Whitout getting errors on "Localhost" connection.)
  5. Hi all, I want to find duplicate records from a joint table result (The two tables are from two different DB's). Bellow are the tables and my requirement. Table1 from DB D1EmpID205205205206207207208209210211 Table2 from DB D2PayID205206207 208 209 210 211 i have joined these two tables on the basis of EmpID = PAYID and got the following result SELECT T1.EMPID,T2.PAYIDFROM D1.table1 T1INNERJOIN D2.table2 T2 onT1.EMPID collate Latin1_General_CI_AI =T2.PayID EmpID PayID 205 205 205 205 205 205206 206207 207207 207208 208209 209210 210211 211 In this result 205 and 207 having duplicate, so i want a query to display the duplicate entries .
  6. I have a major problem with SQL Database. I have a site im working on with over 1k members. When old members book an event the event does not show on their member page. however when a new member joins then goes to book an even the event shows up on their member page. this is getting very confusing. I do know that we attracted some malware onto the site before all the problem started. However this has been cleaned off and there is now no trace of the malware. Can anyone help as im all out of ideas for fixes. I dont want to have to manually rebuild the database as this is too time confusing and would take a long time. Thanks in advance.
  7. i Have 3 table with following fields, 1.users table id, name, password, sub category id, email 2. category table categorie name, category id 3.subcategory table sub category name, sub category id, category id my questian is, how to get users details from user table using category id???????? pleae help
  8. I have a query where I will display how many transactions are made base on the amount of each transaction. But it has an error, the error is that the last amount which is 1,000 above is the same with the total transaction. Can someone check my query? This is my query: SELECT restaurant_master.code, restaurant_master.name, COUNT(CASE WHEN mds_orders.GrossTotal < '100' THEN 1 END) AS less100, COUNT(CASE WHEN mds_orders.GrossTotal >= '100' AND mds_orders.GrossTotal < '200' THEN 1 END) AS less200, COUNT(CASE WHEN mds_orders.GrossTotal >= '200' AND mds_orders.GrossTotal < '300' THEN 1 END) AS less300, COUNT(CASE WHEN mds_orders.GrossTotal >= '300' AND mds_orders.GrossTotal < '400' THEN 1 END) AS less400, COUNT(CASE WHEN mds_orders.GrossTotal >= '400' AND mds_orders.GrossTotal < '500' THEN 1 END) AS less500, COUNT(CASE WHEN mds_orders.GrossTotal >= '500' AND mds_orders.GrossTotal < '600' THEN 1 END) AS less600, COUNT(CASE WHEN mds_orders.GrossTotal >= '600' AND mds_orders.GrossTotal < '700' THEN 1 END) AS less700, COUNT(CASE WHEN mds_orders.GrossTotal >= '700' AND mds_orders.GrossTotal < '800' THEN 1 END) AS less800, COUNT(CASE WHEN mds_orders.GrossTotal >= '800' AND mds_orders.GrossTotal < '900' THEN 1 END) AS less900, COUNT(CASE WHEN mds_orders.GrossTotal >= '900' AND mds_orders.GrossTotal < '1000' THEN 1 END) AS less1k, COUNT(CASE WHEN mds_orders.GrossTotal > '1000' THEN 1 END) AS gtr1k, COUNT(mds_orders.GrossTotal) AS total FROM mds_orders JOIN restaurant_master ON mds_orders.RestaurantID = restaurant_master.PKID WHERE mds_orders.OrderDate BETWEEN '2011-11-01' AND '2011-11-30' GROUP BY restaurant_master.code, restaurant_master.name"; --Thanks. Best Regards.
  9. I would like to show my results like youtube...i know that it uses <div> inside a <div> and then align them with css BUT ! im not sure if it uses the " $row['file_link'] " way or if there is a better way ! thank you
  10. I am working on a website for my work but they will not give me a webserver. So basically I have to run it off a fileshare. This limits me to HTML, Javascript, and CSS formats to get anything done. I need to be able to accept data entered into a form and store it somewhere so it can later be queried for analysis in another website type format. Any suggestions? Somethings to keep in mind also so you know what I'm working with here. - older dell workstations running XP- IE7 is the only browser we are able to use on the work machines- No web server access or ability to pull in data from outside resources since the machines do not have internet access.
  11. Hello internet. I am trying to set up a query that will check to see if there is a row in the database that has the same name the user is trying to submit. Here is my code... how do I make this work? <?php$con = mysql_connect("xxx","xxx","xxx");if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("xxx", $con);$entry=mysql_query("Select FROM testmysql where name='$_POST[rname]'");if($entry='$_POST[rname]');{echo "There is an entry that already exists with the name you selected. Please change the name and re-submit. Thanks.";die();
  12. Hello internet. I am finding it difficult to find any information on how to actually select just one row of data based on the user supplying two specific entries. Any suggestions? I have tried to use select but cannot get it to work to pull a row out with the user specifying which row by entering two specific entries. Please help.
  13. Hello internet.I am working on a project that will need to allow the user the option to delete information they have submitted. What is the proper way to set up a query that will allow the user to enter a specific piece of information from a specific field to be able to delete that whole row of data?
  14. assassin87

    Sum Same Values

    Hi everyone, i want to ask a question. I have some company name and totalroom in my procedure. But when i execute my procedure they are coming twice or more. İ want to sum companies at once. İ took a photo if you check that u will understand what i mean. http://imageshack.us/content_round.php?page=done&l=img546/5725/adszobb.jpg&via=mupload&newlp=1 here is my sql SELECT S.agency, SUM(S.totalroom) ODA, SUM(S.totalpax) KISI, (S.totalrevenue) GELIRFROM SP_FORECAST_OCC_LINE_DAY('01.01.2011','31.12.2011') Swhere S.resmarket='IC PAZAR' AND S.transdate BETWEEN '01.12.2011' and '31.12.2011'GROUP BY S.totalroom, S.agency, s.resmarket, S.totalrevenue
  15. Hello I have this SQL Statement: de.SqlStatement = "SELECT A.Name, A.Catagory , COUNT(Patient_ID) AS PNO FROM PatientApplyToAssociation P INNER JOIN Association A on A.Association_ID = P.Association_ID WHERE A.Catagory='" & "health" & " '" & "' GROUP BY A.Name '" with this Exception: System.Data.SqlClient.SqlException was unhandled by user code class="16" ErrorCode=-2146232060 LineNumber=1 Message=Column 'Association.Name' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. I had this exception when I added the where clause, It seems that the compiler cant see the Group By Section , because of the quotation ending before it, I tried to write it like this: de.SqlStatement = "SELECT A.Name, A.Catagory , COUNT(Patient_ID) AS PNO FROM PatientApplyToAssociation P INNER JOIN Association A on A.Association_ID = P.Association_ID WHERE A.Catagory='" & "health" & "' GROUP BY A.Name '" & " '" But it was an Incorrect syntax near ' '. p.s. I selected A.Catagory because I needed it in the WHERE clause, I need the category to be "health"Any ideas ? Please Help me..Thank you
  16. Hi everyone i want to ask something. Now i have six queries from same stored procdure but i want combine that queries just one query. Here my queries GELİRSELECT SUM(REVENUE) FROM SP_FOLTRANS_STATS_DAY(:B1,:D1) DÜZELTMESELECT SUM(REVENUE) FROM SP_FOLTRANS_STATS_DAY (:B1,:D1) WHERE PAYTYPE='DUZELTME' KREDİSELECT SUM(PAYMENT) FROM SP_FOLTRANS_STATS_DAY(:B1,:D1) WHERE PAYTYPE='KREDI' NAKİTSELECT SUM(PAYMENT) FROM SP_FOLTRANS_STATS_DAY(:B1,:D1) WHERE CASHTYPE = 'NAKIT' KREDİ KARTISELECT SUM(PAYMENT) FROM SP_FOLTRANS_STATS_DAY(:B1,:D1) WHERE CASHTYPE = 'MASTER' OR CASHTYPE = 'VISA' İNDİRİMSELECT SUM(PAYMENT) FROM SP_FOLTRANS_STATS_DAY(:B1,:D1) WHERE PAYTYPE = 'INDIRIM' Now i want GELIR,DUZELTME,KREDI,NAKIT,KREDI KARTI AND INDIRIM with just one query. Can you help me, how can i do that ?
  17. Is there a command line in PHP which can export phpmyadmin data to csv files?
  18. Hi everyone, can anyone help me what is Select 1 query ?
  19. Database Name as Parameter / Variable Hi im using SQL Server Management Studio 2008 addition and im trying to specify a database name for a fix database script we run: ALTER DATABASE MyDatabase SET EMERGENCYDBCC checkdb('MyDatabase')ALTER DATABASE MyDatabase SET SINGLE_USER WITH ROLLBACK IMMEDIATEDBCC CheckDB ('MyDatabase', REPAIR_ALLOW_DATA_LOSS)ALTER DATABASE MyDatabase SET MULTI_USER When I try to replace MyDatabase with a variable the code will not run! Does anybody have any ideas? FYI: Im just learning SQL; please treat me like an idiot! Thanks all
  20. I am making eCommerce Store..there are lot's of inventory and it's update everyday.. I confused, which database support fast indexing ? MySQL, Oracle, MSsql
  21. Hello everyone! The reason I came to these forums is because i have an issue with my code, could you guys look at it and tell me what i am doing wrong?I am trying to retrieve an image from my SQL database in the form of a binary blob, but it doesn't show up. This is the code of the PHP file i am using in my image src html tag: <?phprequire_once("connect.php"); $imgd = $_get['img'];$query="SELECT * FROM ads WHERE id=$imgd";$result=mysql_query($query) or die ("Error - ");$row = mysql_fetch_assoc($result);$image = $row['fotolocatie']; echo $image;;?> it doesn't show the error so it isn't the query witch fails. - Kevin
  22. Hi i'm a newbie in this forum i like W3S is the best page ever for learning and be a web developer and i need help... how do i know if a filed is empty on php & mysql block code and make a redirection on the same page or other files for example... if we have a form called and have this code <html><body><form action="insert.php" method="post">Firstname: <input type="text" name="firstname" />Lastname: <input type="text" name="lastname" />Age: <input type="text" name="age" /><input type="submit" /></form></body></html> and then we have this file call it <?php$con = mysql_connect("localhost","peter","abc123");if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("my_db", $con);$sql="INSERT INTO Persons (FirstName, LastName, Age)VALUES('$_POST[firstname]','$_POST[lastname]','$_POST[age]')";if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); }echo "1 record added";mysql_close($con)?> and if a have fristname as a UNIQUE field in mysql... how do i know if a field is empty and make a redirection to a pages or file? (that includes same files on your root folder) i hope that you help me thx
×
×
  • Create New...