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 199 results

  1. I get the error ERROR 1066 (42000): Not unique table/alias:I cant figure out whats wrong with it.SELECT p.id as id_produk, p.nama_produk, p.stok, p.url_title, p.deskripsi, p.file_name, p.id_kategori_produk, p.fk_jenis_id,p.fk_merk_id, p.fk_gudang_id, p.created_at, kp.id, kp.nama_kategori, jm.id, jm.jenis_material, mm.id, mm.merk_material, gm.id, gm.gudang_material FROM produk as p, kategori_produk as kp, produk as p, jenis_material as jm, produk as p, merk_material as mm, produk as p, gudang_material as gm WHERE p.id_kategori_produk = kp.id, p.fk_jenis_id = jm.id, p.fk_merk_id = mm.id, p.fk_gudang_id = gm.id ORDER BY created_at DESC LIMIT 0, 15Filename: C:xampphtdocstelkomaksessystemdatabaseDB_driver.phpLine Number: 330
  2. jaylow

    foreign key error

    Hello, i have 2 tables. one is for users to sign up and the other is to make character. i added a foreign key to the character table to link it to the members table not when i sign up it just adds me to the table but when i want to make a character it give me this error i want to link the character_id to the id in the members table, so i know what character belongs to what member.. i get: ERROR:could not able to execute INSERT INTO `character` (charname, ######, gold, xp, accdate) VALUES ('jay', 'male', 100000, 0, now()).Cannot add or update a child row: a foreign key constraint fails (`secure_login`.`character`, CONSTRAINT `character_ibfk_1` FOREIGN KEY (`character_id`) REFERENCES `members` (`id`) ON DELETE CASCADE ON UPDATE CASCADE) Members table: CREATE TABLE IF NOT EXISTS `members` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(30) NOT NULL, `email` varchar(50) NOT NULL, `password` char(128) NOT NULL, `salt` char(128) NOT NULL, `accdate` timestamp NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ; `character` table: CREATE TABLE IF NOT EXISTS `character` ( `id` int(11) NOT NULL AUTO_INCREMENT, `character_id` int(11) NOT NULL, `charname` varchar(30) NOT NULL, `######` tinyint(4) NOT NULL, `gold` int(11) NOT NULL, `xp` int(11) NOT NULL, `accdate` timestamp NOT NULL, PRIMARY KEY (`id`), KEY `character_id` (`character_id`)) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;---- Constraints for table `character`--ALTER TABLE `character` ADD CONSTRAINT `character_ibfk_1` FOREIGN KEY (`character_id`) REFERENCES `members` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; without a foreign key i can update the characters table without any issue i messed around with the tables for the last two hours and just dont know anymore. if i switch the foreign key to my members table the sign up does not go into the members table
  3. Hello, i am having issues adding info to a database i have a html from where a user should fill in charname and select ###### then press submit. if i do this i get the error ERROR:could not able to execute INSERT INTO character(charname, ######, xp, gold, accdate) VALUES(jay, male, 0, 100000, now()).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 'character(charname, ######, xp, gold, accdate) VALUES(jay, male, 0, 100000, now())' at line 1 <?php include_once 'db_connect.php'; include_once 'psl-config.php'; $error_msg = ""; $now = time(); // check connection if($mysqli === false){ die("ERROR: Could not connect. " . mysqli_connect_error()); } // Escape user inputs for security $charname = mysqli_real_escape_string($mysqli, $_POST['charname']); $###### = mysqli_real_escape_string($mysqli, $_POST['######']); //attempt inser quesry execution $sql = "INSERT INTO character (charname, ######, gold, xp, accdate) VALUES ($charname, $######, 100000, 0, now())"; if(mysqli_query($mysqli, $sql)){ echo "Records added successfully."; } else{ echo " ERROR:could not able to execute $sql." .mysqli_error($mysqli); } // close connection mysqli_close($mysqli); ?> Table CREATE TABLE IF NOT EXISTS `character` ( `id` int(11) NOT NULL AUTO_INCREMENT, `charname` varchar(30) NOT NULL, `######` tinyint(4) NOT NULL, `gold` int(11) NOT NULL, `xp` int(11) NOT NULL, `accdate` timestamp NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; I was wondering if some one could explain me what i do wrong, and or have some tips how to make this better. the idea is to add a check to see in the "charname" is already used. and some other stuff. but first i like to see the info end up in my DB Thanks
  4. Nuimi

    SQL - Update

    Can you help me with sql, I need update form, but I don´t know how can I do it. $db= new mysqli("localhost", "dany66", "*******", "mathstart"); $email_n = $_POST['email_n']; $vek_n = $_POST['vek_n']; $datum_n = $_POST['datum_n']; if(isset($email_n)) { $update1 = "UPDATE inf(email) SET email= '$email' WHERE jmeno = '" . $_SESSION['username'] . "'"; $pokus = $db -> query($update1); if(fetch_assoc($pokus) == TRUE) { echo("<script> alert('Řádek s e-mailem byl změněn.')</script>"); } }
  5. I love what w3schools is doing with the SQL tutorial - good stuff. I noticed that one of the most fundamental elements of w3schools (the "Try it now" button) goes missing about half-way through the SQL Tutorial. May I ask why? I teach sql at a local community colleg. I have gone through several textbooks with mixed results, and I am always keeping my eyes open for new ways to teach. I would love to incorporate w3schools SQL tutorial into my class; do you have a db dump available for download of the tables you use? One of my lessons will be having students figuring out how to get the data from the tutorial into a local database, but having the entire dataset available up front would be handy. If such a db dump is not available, no worries - easy enough to generate one. Thanks again for your time and attention.
  6. I have a mySQL posts table, a files table, and a relationships table. I need to sum file download counts grouped by the post the files are associated with. SELECTp.id, p.post_title, count(d.download_id) FROM posts p INNER JOIN file_log d ON p.id = d.file_idgroup by p.post_title The above query works as long as the titles of the files are the same, which is not always the case. I really need to group them by their relationship to the post they are associated with. The relationships are stored in relationships r, which shows r.post_id (which is p.id from posts), and r.file_id (which is d.file_id from file_log) I have tried a few subqueries, but I am not sure how to join the relationships table to my query and group counts by r.post_id Thanks for any help.
  7. Hey everyone, I wanted to share with everyone the book "SQL QuickStart Guide" that is currently free in the Amazon Kindle store. You can download here: http://www.amazon.com/SQL-QuickStart-Guide-Simplified-Structured-ebook/dp/B00UCFK44U/ref=sr_1_18?s=digital-text&ie=UTF8&qid=1427911263&sr=1-18&keywords=sql
  8. Hello, I need delete row in html table select row and click button delete make delete using ajax Currentally can make delete without ajax but I need delete row and stay on page without make submit on other page code html,php <?php $resualt=mssql_query("SELECT * FROM Address where user_id='$UserId' ") ;echo "<table border='1' class='imagetable' id='imagetable'width='400px' >n";echo '<thead>'.'<tr>';echo '<th>Street</th>'.'<th>Quarter</th>'.'<th>From</th>'.'<th>To</th>'.'<th>Notes</th>';echo '</tr>'.'</thead>';echo '<tbody>';while ($row = mssql_fetch_assoc($resualt)) {$fromDate=$row['from_date'];$toDate=$row['to_date'];echo " <tr onClick='myPopup($row[id])'". ( $_GET['id'] == $row['id'] ? "style='background-color: green;'":"").">n"."<td >{$row['street']} </td>n"."<td>{$row['quarter']}</td>n"."<td>$fdate2</td>n"."<td>$tdate2</td>n"."<td>{$row['other_info']}</td>n";}echo '</tbody>';echo "</table>n";?> //button delete <?phpecho"<a class='button-link' href='delete_address.php?id=$id'>delete</a>"; ?> code sql to make delete from db <?php$idEmploye=$_GET['id'];$db_host = 'jo';$db_username = 'jo1';$db_password = '123321';$db_name = 'db_test';mssql_connect($db_host, $db_username, $db_password);mssql_select_db($db_name);mssql_query("DELETE FROM AddressWHERE id='$idEmploye' ; ") or die(mssql_error()) ;echo '<script language="javascript">';echo 'alert("successfully deleted ")';echo '</script>';echo "<script>setTimeout("location.href ='address.php';",10); </script>"; ?> Any Help Thanks
  9. I currently am doing a little work on a seasonal website for our golf league and wanted to improve the content with some databases. Going online and reading some articles regarding doing this I came across the issue of whether to write my code using SQL object oriented, SQL procedural or I guess what is the latest and greatest scripting, PDO. What I have read is that if I have any thought of changing over to another database type other than SQL, PDO would be the way to go. But my thought is that I most likely would not because I not only may never deal with other types of databases but I do not think that all these Hosting sites which SQL is most likely ingrained in would change and make their thousands of customers recode all their scripts. “Am I wrong” When I was taught PHP/SQL, I believe it was using the Procedural method, which appears not to be far from the object oriented script. PDO seems to be a little more involved in learning its syntax. What would your recommendations be for me? I would learn the PDO method if you think it would be beneficial. But if not necessary, I will stick to what I already feel comfortable with. All comments greatly appreciated. P
  10. I love the work going on at w3Schools - awesome stuff! For the SQL Tutorial, might I suggest a accessible logical model for the tables? For instance, in the "Try it" demo pages, there is a right-hand-side pane with all the available tables, but there is no way to just view the columns of those tables without leaving behind the current sql worksheet. It would be tremendously helpful if users/students could view, via some kind of client-side magic (javascript?), the model of the tables. Ideally, this would include the metadata like primary key and constraint information, but just starting with the name of the columns would be sweet. Thanks for your time and attention.
  11. Hey all!A bunch of us have been putting together a web-based drawing app. In a nutshell, users connect in real-time to draw or chat on a sort of interactive whiteboard. Plenty of these are made in Flash, but we are determined to build it in JavaScript and HTML5; a site that immediately works on mobile (because it's not Flash), tailors to everybody from drawing tablet users to people who want to screw around, chat and play games — and with an awesome, modern look that other apps lack. The thing that works so well is these kinds of programs give you a lot of freedom of expression that I think by making more accessible we can popularize, and truly get a future-proof, lasting community going.Current drawing apps aren't too popular as they're not accessible to the host of many devices people use, chatting's not versatile or user-friendly enough to compete with chat sites, and their designs look god-awful like it's still the 90's. So with what we're after, there's insane potential in this project. This is the interface. I hope it gives you some sense of what we're aspiring for. It's predominantly HTML, CSS, and JS with server-client communication in HTML5's WebSockets, and some points in PHP. If you're good with any of these, message me here, Skype drawplanet or email form@drawplanet.net. I'll be more than happy to answer any questions. And if you're critical of anything, nothing's set in stone. It's very much a by the community, for the community type of project. Also on the hunt for people good with P2P networking, node.js, SQL, or server management.
  12. Hello everyone, I did try to search alot for an answer on this one, but I could not find it anywhere. I'm trying to have a simple search feature for my site, but I keep getting a blank page when doing a search containing multiplie words "like this" Tried to work it out with a str_replace but did not do the trick, have done this before, and it does work when just outputing the val as an echo instead of a query, so I'm blank now and appreciate any help! //function for replacing empty space with % function moreWords($val){$val = str_replace(" ","%", $val);return $val;} //Query$getCategoriesResults = mysql_query("SELECT * FROM `database`.`forumCategories` WHERE description LIKE '%".moreWords($_GET['search'])."%'");
  13. I want to develop a library system in which fine will be calculated as follows- the code should be in php and sql database. I want to retrieve date from database and subtract it from current date. The difference will be then multiplied with 5 to know the fine. How can I do this? How can i retrieve date from database and subtract it from current date? returndate is column name from where i want to retrieve date for id=1 and issret is the table name. <form id="form1" name="form1" method="post" action=""><label for="txtDueDate"></label><input type="text" name="DueDate" id="txtDueDate" /><input type="submit" name="submit" id="submit" value="Submit" /></form><?phpif(isset($_POST['submit'])){$result=mysql_query("select returndate from issret where id=1"); if(mysql_num_rows($result)>0){$x=date("Y/m/d");$diff=date_diff($result,$x);echo $diff->format("%R%a days");}}?>
  14. Hello, i am trying to retrieve data from five different tables and union the tables into one. I was wondering if there is anything I can do in my coding to make it more efficient as it is taking considerable time to run. The code is: SELECT 'Order' As Order_Trade ,[sourceSystemId] ,[ReceivedData] As Order_Trade_Date ,[ReceivedTime] As Order_Trade_Time ,[LastExecutor] As Trader ,[ExecutingBookId] As Book ,[OrderId] As Order_Trade_ID ,[buySell] ,[CounterpartyCode] ,[ExchangeId] ,[Version] As VersionNumber ,[instrumentCode] ,[TotalQuantity] As Order_Trade_Quantity ,[OrderNotes] As Order_Trade_Notes ,[OrderDesk] As Desk FROM [CoreRDSPrd].[core].[tblRdsTsHostedOrderProgress] WHERE [LatestVersion] = 'Y' AND [sourceSystemId] = '62' OR [sourceSystemId] ='65' AND [ReceivedData] > DATEADD(d, -2, current_timestamp) ---------------------------------- UNION SELECT 'Order' As Order_Trade ,[sourceSystemId] ,LEFT([Timestamp], 8) As Order_Trade_Date ,SUBSTRING([Timestamp], 9,9) As Order_Trade_Time ,[ClEnteredBy] As Trader ,[ClBookId] As Book ,[ClOrderId] As Order_Trade_ID ,[ClBuySell] As BuySell ,[ClCounterpartyCode] As CounterpartyCode ,[ExchangeId] ,[ClVersion] As VersionNumber ,[instrumentCode] ,[ClQuantity] As Order_Trade_Quantity ,[ClOrderNotes] As Order_Trade_Notes ,[OrderDesk] As Desk FROM [CoreRDSPrd].[core].[tblRdsTsOrder] WHERE [LatestVersion] = 'Y' AND[sourceSystemId] = '62' OR [sourceSystemId] ='65' AND LEFT([Timestamp], 8) > DATEADD(d, -2, current_timestamp) ---------------------------------- UNION SELECT 'Trade' As Order_Trade ,t.[sourceSystemId] ,ts.[ClTradeDate] As Order_Trade_Date ,ts.[ClTradeTime] As Order_Trade_Time --,LEFT([Timestamp1],8) As Order_Trade_Date --,SUBSTRING([Timestamp1], 9,9) As Order_Trade_Time ,t.[updateUser] As Trader ,t.[ClBookId] As Book ,t.[ClTradeId] As Order_Trade_ID ,t.[ClBuySell] As BuySell ,t.[ClCounterpartyCode] As CounterpartyCode ,t.[ExchangeId] ,t.[ClVersion] As VersionNumber ,t.[instrumentCode] ,t.[ClQuantity] As Order_Trade_Quantity ,t.[ClBusinessTransaction] As Order_Trade_Notes ,'111111' As Desk FROM [CoreRDSPrd].[core].[tblRdsTsTrade] t, [CoreRDSPrd].[core].[tblRdsTsTradeSet] ts WHERE ts.[LatestVersion] = 'Y' AND t.[sourceSystemId] = '62' OR t.[sourceSystemId] ='65' AND ts.ClTradeSetId=t.ClTradeSetId AND LEFT(t.[Timestamp1], 8) > DATEADD(d, -2, current_timestamp) ---------------------------------- UNION SELECT 'Trade' As Order_Trade ,[sourceSystemId] ,[TradeDate] As Order_Trade_Date ,[Tradetime] As Order_Trade_Time ,[Trader] ,[bookId] As Book ,[TradeId] As Order_Trade_ID ,[buySell] ,[Counterparty] As CounterpartyCode ,[ExchangeId] ,[VersionNumber] ,[RICCode] As InstrumentCode ,[Quantity] As Order_Trade_Quantity ,[businessTransaction] As Order_Trade_Notes ,[CustomSource] As Desk FROM [CoreRDSPrd].[core].[tblRdsTsEtpMarketTrade] WHERE [LatestVersion] = 'Y' AND [TradeDate] > DATEADD(d, -2, current_timestamp) AND [sourceSystemId] = '62' OR [sourceSystemId] ='65' is there anything that can be done to make this query quicker, or is the lag as a result of the many rows which i expect it to return? Thanks, Lorijent Lamce
  15. Hi i have a table called hospitails. the table structure is as below Hospitals:- Hospital_id Bigint name varchar(45) city_id bigint district_id bigint state_id bigint now i need to search hospitals based on name,city_id,district_id,state_id. the query must cntain all the 4 fields. when user does not provide any of the value all the hospitals with all the names from all the cites,districts,states has to be listed. when user provides partial name and ignores the rest of the three fileds, it has to provide all the hospitals that starts with that name from all cities,districts,states, when user ignores the other 3 fields and provides the city_id then all the hospitals should be listed from that city Like wise. for varchar columns if we apply 'like' then it does this kind of things but how to do this when there are bigint columns? I need this query. please help.
  16. I am not sure if this is the right place to ask this question so forgive me if it is not. I am having some challenges encrypting/decrypting and even using passwords in plaintext. I noticed that "the use of passwords" was not included in the PHP/mySQL tutorial examples (I am still wondering why since most websites require passwords). Please can someone direct me to a section where the use of passwords was explained? The way w3schools.com explains basics makes it very easy for me to understand and get a firm foundation that is why I will love if it was explained in this website. Thank you.
  17. I am wondering why this is not working. I have a table of order line items. each order can have multiple line items with the same transaction ID just different item codes. I am trying to find single transaction ID's with a specific item code. I also tried doing a count (transactionnumber)<2 but could not figure out how to add a where for the item number. So an order for just this item select distinct(transactionnumber) from Orders (I thought this would select any unique transaction number IE only one occurance)where Code='9987' When I run the above and check the transaction numbers it is any transaction with that code not transactions with only that code? I also tried this select * from OrdersWhere (select COUNT(transactionnumber)from Device_Orders) <2 and ItemCode='9987' This returns no records when I know there are single transaction numbers with that item code? Any suggestions would be appreciated
  18. Hi, I've just built a basic web site, but I now realise (by going through the process) that I need to understand other languages & processes in order to make the site streamlined & fully functional. Because I've only learnt html & css (on a basic level) my understanding of php, sql, js, xml, etc is very poor. I therefor need some advice on what the best mechanisms are for inputting data, storing it & displaying it on the web, possibly with some type of rss feed too. The basic process the site is doing, can be described as follows: 1. Users enter data using an online form. 2. Data is stored on a database & manually verified. 3. Certain info from the database is automatically displayed on the site (but not all) in a friendly viewable format. 4. Every time the site is updated a feed is created (like an rss or blog). The first two processes I have achieved, but I am exploring ways of achieving the 3rd & 4th processes. Any advice on what methods or languages would be best to use would be greatly appreciated. I'm happy to learn any coding required. The data set can be stored in various formats (xlsx, csv, ods, tsv, etc), its really a question of the best way to interpret it & automatically display it that I am exploring. Along with creating the feed. Thanks for any advice. Old Guy.
  19. I need your expertise on this problem I have. I have a Vehicle/Driver Inspection Database and I'm trying to create a Traffic Violation Point System, its a system when drivers commit certain traffic offences they will incur driving-offence points.System: The points for violations that all occurred within the last 12 months of ONE ANOTHER are added together to calculate point total. If the accumulated points is reached 14 points driver is suspended the points will be REMOVED or minus 14 points after the suspension has been served.Example:Date of Offence - Number of Points [*]Aug. 6, 2013 - 6[*]Sept. 14, 2013 - 4[*]Feb. 4, 2014 - 4[*]Apr. 25, 2014 - 4[*]Apr. 25, 2014 - 2[*]May 8, 2014 - 2 Explanation:On April 25, 2014 two offences incurred and from (Aug 6, 2013 - Apr. 25 2014) 14 points have accumulated (6 + 4 + 4) and suspension is carried out then 14 points is removed. The 2nd offence on Apr. 25, 2014 will be carried forward and added to May 8, 2014 points (total 4 points).Below are DB Tables:tbl_Driver [*]DriverID[*]Driver License[*]FirstName[*]LastName tbl_Event [*]EventID[*]EventTime[*]DriverID[*]CarID tbl_EventViolation [*]EventViolatinID[*]EventID[*]ViolationID[*]Status (1 = no, 2 = yes radio buttons) tbl_Violation [*]ViolationID[*]ViolationName[*]Points tbl_ViolationClass [*]ViolationClassID[*]ClassName I made an SQL Code but to sum the accumulated points only but not the whole condition. See below: SELECT a.DriverId, a.DriverLicense, a.FirstName + ' ' + a.LastName as DriverName, a.FirstName, a.LastName, a.DriverMobileNo1, a.Notes, SUM(a.Points) as TotalPoints FROM ( SELECT dbo.Event.EventTime, dbo.Drivers.DriverID, dbo.Drivers.DriverLicense, dbo.Drivers.FirstName, dbo.Drivers.LastName, dbo.Drivers.DriverMobileNo1, dbo.Violation.ViolationName, dbo.Violation.Points, dbo.Drivers.Notes FROM dbo.Drivers INNER JOIN dbo.Event ON dbo.Drivers.DriverId = dbo.Event.DriverId INNER JOIN dbo.EventViolation ON dbo.Event.EventId = dbo.EventViolation.EventId INNER JOIN dbo.Violation ON dbo.EventViolation.ViolationId = dbo.Violation.ViolationId INNER JOIN dbo.ViolationClass ON dbo.Violation.ViolationClassId = dbo.ViolationClass.ViolationClassID WHERE dbo.EventViolation.Status = 2 AND dbo.ViolationClass.ClassName Like 'C' AND dbo.Violation.ViolationName Not Like 'LOAD NOT CORRECTLY RESTRAINED' AND dbo.Violation.ViolationName Not Like 'DRIVING WITHOUT UAE LICENSE' ) as a GROUP BY a.DriverId, a.DriverLicense, a.FirstName, a.LastName, a.DriverMobileNo1, a.NotesORDER BY Points desc Please anyone try to modify the code to work on the conditions set above to have a column with Total Points (with conditions above)Thank you for your time. Looking forward for the solution.
  20. Hi all PHP newbie and first post! I hope someone can help. I have looked at some of the tutorials but still can't get my head around how to get the data from within a PHP script. Trying to create a form with two fields "Date" and "Channel" to look at the 'calldate' and 'channel' columns and then give a count result, so just want to find whatever specified on the form and give the number of ocurrences found grouped by date. Ie, how many ocurrences for specified 'chanel' %CLI/1234567% for a given date. Thanks
  21. I have recently started a new position in my company as a Junior Database Developer. I have previously worked in Data Analysts roles; mainly using advanced Excel & VB. I have a strong passion for SQL, as I now aim to develop my career down the Database Developer route. In my first month, I have began to get to grips with using SQL syntax; building and creating tables etc. Whilst I appreciate it takes time to understand how processes work, I am eager to further understand what things mean; how things work & why. After reading up on numerous forums, not everything is explained easily for beginners. I much prefer seeing working examples of things, using analogies. I am reaching out to SQL gurus to help explain a few items for me. Unfortunately, I am unable to attach the Word document with my requirements. If anybody can be of any support, and therefore get in touch, I will be very grateful! Regards, Ben
  22. hello friends I have a table with three columns col1,col2 and col3. how do I add rows based on column1? col1|col2|col3| A | 2 | 4 | B | 6 | 8 | A | 10 |12| C | 14 |16| C | 3 | 2 | Output col1 col2 col3 ----|-------|-------| A | 12 | 16| B | 6 | 8| C | 17 |18| I am running the query in ms access from vb.net, can someone tell me why it does not work select col1, SUM(col2) as col2, SUM(col3) as col3 from table1 group by col1 Thanks
  23. hello friends I have two tables with column A and column B. I want to update column B of table9 with column B of table1 . I am trying this query in ms access from Vb.net. It pastes the column below the existing data. How do I write a update query that will replace the existing column? update table1 t1 LEFT JOIN table9 T9 on t1.a = t9.a SET t9.b = t1.b Thanks
  24. TotalWhat

    SQL Question

    This question has been solved. The solution is at the bottom. Hi! So here's the question for you. I use Microsoft SQL Server Management Studio. I have a table 'Frogs', that has two attributes. FrogName and FrogHabitat. If I do a select * from the table the output is something like this: FrogName FrogHabitat Wood frog Iceland Wood frog Denmark Wood frog Sweden Sky frog Iceland Sky frog Germany Hill frog France Hill frog Sweden The question is: "Write the query that would produce the FrogName of pairs of Frogs whom both share the same FrogHabitat". And the final output should look like this: FrogName FrogName Sky frog Wood frog Wood frog Sky frog Hill frog Wood frog Wood frog Hill frog I have thought about this allot but I can't figure out what the right query would be. Any help along the way to enligthment would be much appreciated! Thank you!
  25. Does Anybody have a SQL code that does the following ones of or is it done in parts?1. DB Schema Design - Design a basic database to store the following information + A fleet of Vehicles - Include details such as mileage, vin numbers etc + A pool of drivers - Include relevant documentation, e.g. Drivesr license, ID Book + A group of routes - Marking out GPS coords for directions etc. is not necessary, just include a start & end address as well as any other info you believe to be pertinent + A drivers schedule, tying the above 3 tables together
×
×
  • Create New...