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


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

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Found 189 results

  1. Hello All, I am trying to get the latest record available for a field, I want to learn how to write/pull what I know as of record status "1" from my results since let's say; an activity was updated several times but I just need the latest update base on the date, I tried using distinct and it worked: each row is different but I am still receiving all the updates of each activity. I tried to use (Group by) base in the activity Id and I am receiving this error message "Column 'activity_name' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause." I am using the Microsoft SQL server management studio.
  2. Hi, I want to be able to filter by date looking back 6 months. I then want to include data from 12 months, 18 months, 24 months etc How would i do this without having to repeat myself? Currently i am using the below and then repeating it e.g between dateadd(dd,-189,getdate()) and dateadd(dd,-183,getdate()) between dateadd(dd,-373,getdate()) and dateadd(dd,-366,getdate()) Thanks in Advance,
  3. Hi, I am trying to join two tables that have similar fields, but in slightly different formats. I was previously using something along the lines of like '%*%' Then SUBSTRING(b.fieldname,CHARINDEX(b.fieldname,'*',1)+1,9) However the format has now changed and I am struggling to put something together. Table A BD8K1 23161*35*201904231110*QULN Table B 23161*35*1 However the number of characters in both could vary so cant use that. Table A BD8K1 242875*10*201904251015*NBB1 Table B 242875*10*113 Is there some code that could be written that's something like: A – From the space use the value up to and including the 2nd * (BD8K1 is at the beginning of every value in table A so could potentially use from character 7) B – Use the value up to and including the 2nd * Any help would be very much appreciated. Thanks James
  4. Hi . I'm having trouble with the AUTO INCREMENT statement in SQL. I've built the table : CREATE TABLE tenants( apartment_number_first_floor INT AUTO_INCREMENT, family_name VARCHAR (12) DEFAULT NULL, sur_name VARCHAR (8) DEFAULT NULL, telephone_number INT(3) NOT NULL, PRIMARY KEY (apartment_number_first_floor) ); when inserting a row: INSERT INTO tenants VALUES(' ',' '); The IDE doesn't accept the column count: ER_WRONG_VALUE_COUNT_ON_ROW: Column count doesn't match value count at row 1 So i tried filling the rows just to check if the IDE will run the statement INSERT INTO tenants VALUES(103,'שקלובין','מרתה',203); but the IDE refuses to increment Any ideas? Thanks
  5. Hello w3schools community ! I would like to know .. - What is exactly the difference between SQL ( Structured query language ) and MySQL ?, ( with examples if possible ) - Does learning SQL suffice ? Or should I use a RDBMS such as MySQL, Oracle .. etc ? Thank you .
  6. Hello everyone, i must do a query that finds all words that finish whit a,e,i,o or u. i' ve used this query but my output in empty . select City from Station where City like '%[aeiou]'; i' ve used the wildcards wrongly?
  7. I have a diagram representing a database and need to find a way to update a given table with respect to information about elements in that table. Here is the database design: https://i.stack.imgur.com/HR6q2.jpg I have a Playlist defined which is called "Frank's Stuff" which is owned by the Customer Frank Harris. The question is the following: Update the playlist "Frank's Stuff" as a function of the track duration. Display this playlist with the TrackID, Name and Milliseconds to verify. I've read that you cannot use an ORDER BY statement with and UPDATE statement unless it is enclosed in a SELECT statement. I'm not quite sure how to do all this though and would greatly appreciate some help. Thanks!
  8. shivangi saxena


    can we grant / give access of DDL commands to others ?
  9. So I'm trying to filter some records out of my select inside a form on my website. Problem is that I currently have this setup: Database Table1 Time Number Table2 Number Something I'm trying to filter time by checking how many records show up of number in table2 So basically I select time from table1 where number is less than <some amount> in table2 How do I actually put that in sql? I currently have this but it isn't working: SELECT Time FROM Showcase WHERE Number IN (SELECT COUNT(Number) FROM Build WHERE COUNT(Number) < 50); it currently doesn't end up with anything but in theory it should show the times from the records where the count of the value of number is less than 50 so if Number = 40 and it gets counted 70 times it shouldn't show up. but if Number = 30 is counted 29 times it should show up can anyone tell me what is going wrong?
  10. Hiral

    Help in SQL query

    Hello Everyone, I am writing a query in SQL to pull the first date an employee became a teacher with no break in service. using the job table here to find effective date when a employee became teacher like example. 1. Teacher - 1/1/18. 2. coordinator- 2/1/18 3. Teacher- 3/1/18 Here in result I need the last entry as there is no gap in that title now.
  11. No keywords are highlight. for what reason behind that. please help me Here is my HTML code and at the bottom PHP. HTML CODE: <form id="nbc-searchblue1" method="post" enctype="multipart/form-data" autocomplete="off"> <input type="text" id="wc-searchblueinput1" class="nbc-searchblue1" value="<?php echo $search; ?>" placeholder="Search Iconic..." name="search" type="search" autofocus> <br> <input id='nbc-searchbluesubmit1' value="Search" type="submit" name="button"> </form> PHP CODE: <?php // We need to use sessions, so you should always start sessions using the below code. session_start(); // If the user is not logged in redirect to the login page... if (!isset($_SESSION['loggedin'])) { header('Location: ../index.php'); exit(); } include 'connect.php'; $search = $sql = ''; if (isset($_POST['button'])){ $numRows = 0; if (!empty($_POST['search'])){ $search = mysqli_real_escape_string($conn, $_POST['search']); $sql = "select * from iconic19 where student_id like '%{$search}%' || name_bangla like '%{$search}%' || name like '%{$search}%' || phone like '%{$search}%' || blood like '%{$search}%' || district like '%{$search}%'"; $result = $conn->query($sql); $numRows = (int) mysqli_num_rows($result); } if ($numRows > 0) { echo "<table> <thead> <tr> <th><b>Photo</th> <th><b>Student ID</th> <th style='font-weight: 700;'><b>নাম</th> <th><b>Name</th> <th><b>Mobile No.</th> <th><b>Blood Group</th> <th><b>Email</th> <th style=' font-weight: 700;'><b>ঠিকানা</th></tr></thead>"; while ($row = $result->fetch_assoc()){ $student_id = !empty($search)?highlightWords($row['student_id'], $search):$row['student_id']; $name = !empty($search)?highlightWords($row['name'], $search):$row['name']; $district = !empty($search)?highlightWords($row['district'], $search):$row['district']; echo "<tbody>"; echo "<tr>"; echo "<td>" . "<div class='avatar'><a class='fb_id' target='_blank' href='https://www.facebook.com/" . $row['fb_id'] . "'><img src='" . $row['photo'] . "'><img class='img-top' src='fb.png'></a>" . "</td>"; echo "<td data-label='Student ID'>" . $row['student_id'] . "</td>"; echo "<td data-label='নাম' style=' font-weight: 700;'>" . $row['name_bangla'] . "</td>"; echo "<td data-label='Name' style='font-weight:bold;' >" . $row['name'] . "</td>"; echo "<td data-label='Mobile No'>" . "<a href='tel:" . $row['phone'] . "'>" . $row['phone'] . "</a>" . "</td>"; echo "<td data-label='Blood' style='color:red; font-weight:bold;' >" . $row['blood'] . "</td>"; echo "<td data-label='Email'>" . "<a href='mailto:" . $row['email'] . "'>" . $row['email'] . "</a>" . "</td>"; echo "<td data-label='ঠিকানা' style='font-weight: 700;'>" . $row['address_bangla'] . "</td>"; echo "</tr>"; echo "</tbody>"; } } else { echo "<div class='error-text' style='font-weight: 700;'>No Result</div><br /><br />"; } } $result = $conn->query("SELECT * FROM iconic19 $sql ORDER BY id DESC"); function highlightWords($text, $word){ $text = preg_replace('#'. preg_quote($word) .'#i', '<span style="background-color: #F9F902;">\\0</span>', $text); return $text; } $conn->close(); ?>
  12. JCabral


    Hi I am new to this forum and very new to this SQL issue. As you know Excel allows you to sort a set of data in ascending or descending order and through an ordered list. And here begins my problem, ie I would like to know if it is possible to do this order through a SQL statement. Sort ascendingly and descending I already know how to do but what I wanted, and it is shown in the example I attached, it was first to sort by field F58 in ascending order and then to sort by field F66 by the following list 'RR-CON, RR-COGP, RR -COCN, RR-COCS, RR-COGL, RR-COS ' I've got an example, with the VBA code that fetches me a table from the F58 and F66 values according to certain criteria, and then that data is only sorted by field F58, I'd like it to be sorted from the list above. It's possible? Many thanks Jorge Cabral Teste com SQL_V1 - ENG.xlsm
  13. Hiral


    Hi, Need help in code trying to find employees old positon number but the job table gives current row position number since the employee was rehired. Please help.
  15. I am having a small issue translating my excel if statement into a CASE clause. Bellow I have posted my current SQL statement and the IF statement i am trying to fit in. I At the moment i have wrote it into the WHERE Clause but when i run it only returns the data which applies to the product description. Because of the way my where clause is set up it mean i only get half results where as i want it to show if column a does not match criteria then look for certain items in column b IF Statement is =IF(PD="AC","S",IF(PD="CS","S",IF(PD="CA","S",IF(**PT="SS","S"," ")**))) Current SQL SELECT AEOrdersReceivedCurrentQuarter.`Order Company` , AEOrdersReceivedCurrentQuarter.`Sop Order Number` , AEOrdersReceivedCurrentQuarter.`Order Date` , AEOrdersReceivedCurrentQuarter.`Order Method` , AEOrdersReceivedCurrentQuarter.`Payment Method` , AEOrdersReceivedCurrentQuarter.`Product Type` , AEOrdersReceivedCurrentQuarter.`Product Sub Type` , AEOrdersReceivedCurrentQuarter.`Product Description` , AEOrdersReceivedCurrentQuarter.`Quantity Ordered` , AEOrdersReceivedCurrentQuarter.`Product Item Value` , AEOrdersReceivedCurrentQuarter.`Order Count` , AEOrdersReceivedCurrentQuarter.`Order Item Narrative` , AEOrdersReceivedCurrentQuarter.`Product Group` , AEOrdersReceivedCurrentQuarter.`Product Category` FROM AEOrdersReceivedCurrentQuarter.csv AEOrdersReceivedCurrentQuarter WHERE (AEOrdersReceivedCurrentQuarter.`Product Type` = 'Studio Services' OR AEOrdersReceivedCurrentQuarter.`Product Description` IN ('Artwork Charge','Creative Services','Creative Agency','Studio Services') )
  16. Hello, I have a report looking at courses for my college. Each course can have multiple attributes (which I return with a sub query for each stating 'Y' or 'N' if they are associated with said attribute). My end user is requesting an additional column which states if they are associated with multiple attributes - so the column will return 'Y' if they have multiple attributes, or a 'N' if they only have one attribute. I am requesting assistance in coding the 'Multiple' column, as I am returning a Y or N for each attribute by using sub queries, and not quite sure how to compare the sub queries together to return a value if they have multiple attributes (meaning more than one of the sub queries will return a 'Y'). Thank you.
  17. I have a website named Advisorymandi.com - From last 2 days I'm facing unwanted traffic from unknown source. Its Server is not working even website is not open. Can any one help me please to resolve it.
  18. Hi all ! I wrote this short code : <html> <head> <style> table, th{ max-width: 600px; } .e2 { width: 200px; } </style> </head> <div style="background-color:TRANSPARENT;width:603px"> <body> <table> <tr bgcolor="TRANSPARENT" height="20"> <td class="e2" style="background-color:GREEN"></td> </tr> </table> </body> </div> </html> I have a data base column (in oracle apex), And I would like to have something like that (a multiplication) : .e2 { width = #column# * 600; } Because I would like to have a green horizontal bar chart with different size depending on the values in my database column. So, I tried calc() : did not work... And I also tried : <td style="background-color:GREEN" width=#column#*600></td> <td style="background-color:GREEN" width=calc(#column#*600)></td> Those 2 lines did not work too.. Do you have any idea how to do this multiplication please ? Best regards, acnos
  19. Hi everyone, I will like to know how to have table under master table. Is it relationship? or how you do that? Thanks, Gary
  20. Hi, I have a goDaddy account and I'm learning to import data. I've had success with a couple of uploads, but I get an error message and I don't understand what I need to do to get rid of it. My code is below, along with the error message I get and the excerpt from the mySQL documentation. Can anyone offer some advice about how to proceed and what may be the problem? The query works and updates the table with the info perfectly, but I think I should find out what this error is b/4 I incorporate into my website. Thanks a million! SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; CREATE TABLE IF NOT EXISTS `myUsers` ( `UserID` char(8) NOT NULL, `firstName` varchar(24) NOT NULL, `lastName` varchar(24) NOT NULL, `viewPref` varchar(16) NOT NULL, `pagePref` varchar(48) NOT NULL, PRIMARY KEY (`UserID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; INSERT INTO `myUsers` (`UserID`, `firstName`, `lastName`, `viewPref`, `pagePref`) VALUES ('sak20007', 'John', 'Smith', 'mobile_phone', 'about.html'); UPDATE; #1064 - 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 '' at line 1 Error: 1064 SQLSTATE: 42000 (ER_PARSE_ERROR) Message: %s near '%s' at line %d
  21. Hi everyone, I know how to create new table by PHP, but I don't know how to have relationship to prime table such as account or register table once a new table is insert. Can you please show me how to do that? I know how to create new table, but my point is once table is insert in phpmyadmin, then have relationship connect to prime table. If you are not sure, I will explain more about this. Thanks, Gary
  22. Hi everyone, I am trying to get all data from input in HTML, then post in php to insert into the database (phpmyadmin), seem it doesn't work. I checked for misspelling, and checked followed very correct, but it won't work, even it did not show what is error. "require.php" file is a connect to database. Can you help? Thanks, Gary <?php require("require.php"); $first = $_POST['first']; $last = $_POST['last']; $address = $_POST['address']; $address2 = $_POST['address2']; $city = $_POST['city']; $state = $_POST['state']; $birth = $_POST['birth']; $zip = $_POST['zip']; $home = $_POST['home']; $mobile = $_POST['mobile']; $gender = $_POST['gender']; $insert = "INSERT INTO register ( ASL-PT_ID, FirstName, LastName, Address 1, Address 2, City, State, Zip, BirthDate, Home, Mobile, Gender) VALUES ('$first', '$last', '$address', '$address2', '$city', '$state', '$zip', '$birth', '$home', '$mobile', '$gender')"; if ($first && $last && $address && $address2 && $city && $state && $zip && $birth && $home && $mobile && $gender) { mysqli_query($GaryDB, $insert) or die("Could not add in the Database"); } ?>
  23. Hi I have a query that returns the count of entries based on CURDATE(), it works for any dat in this month (April) but does not work for next month (May). I think it is something to do with CURDATE()+3 returns 2018-04-31 which should be 2018-05-01 This Works as Date is in April SELECT COUNT(Machine) FROM production WHERE Status = 'Confirmed' AND DATE(FROM_UNIXTIME(production.Required)) = CURDATE() This does not work as in May SELECT COUNT(Machine) FROM production WHERE Status = 'Confirmed' AND DATE(FROM_UNIXTIME(production.Required)) = CURDATE()+3
  24. Hola buenas, tengo que decir que todavia estoy aprendiendo, soy muy nobato en este tema, aprendiendo me he quedado bloqueado y no se como seguir, se lo que son los dorks, el sqliv sqlmap ect... yo uso el jsql injection. Me gustaria saber como centrar una lista de dorks en una sola url, ya que todos los videos que he visto, lo que hacen es poner un dork en google y cojer una paguina al azar, lo suyo seria cojer una url deseada y meterle dorks para hallar una vuneración y de ahi ver/modificar/actualizar los datos de la paguina web. Estoy intentado cojer los datos de un juego online que creo que tiene algo (muy poco) de seguridad ante injection sql que es www.boombang.nl/index.php. Si hay alguna alma caritativa que sepa del tema y me puede ayudar, mil gracias adelantadas
  25. Hello. Stupid question here. So when i write sql code inside variable, do i need to change it (the variable) everytime or will php be able to see to difference? Lile this: $sql = "select * from users" $result = execute sqk here... $row = output here.. fetch data... $sql = "select * from stars" ... And so forth? Or do i need to change the variable everytime so php can know each different sql code and fetches everytime? Thx in advance.. Ps: writing from a cellphone, sorry if i dont deliver perfect info, so hope you understand the question If not, ask and ill retype the question when home later tonight at my laptop Thanks a lot
  • Create New...