check field1 and field2 from single table
Hello, In SQL: I want to check. From single table, if(field1 = 1 and DATE_SUB(CURDATE(),INTERVAL 7 DAY) <= field2) then return count(*) else return "false" thanks v.srinath ...
Hello, In SQL: I want to check. From single table, if(field1 = 1 and DATE_SUB(CURDATE(),INTERVAL 7 DAY) <= field2) then return count(*) else return "false" thanks v.srinath ...
In a classifieds website, you have several categories (cars, mc, houses etc). For every category chosen, a hidden div becomes visible and shows additional options the user may specify if he/she wishes. I am creating a db now, and I have read some articles about normalization and making it optimized etc... Here is my layup today CATEGO...
I want one record from a table having unique Primary Key and duplicate Foreign Key Please see attached image below Thanks ...
hi, I have a question that how can we use SELECT for searching the name which start with 'A' in MySQL table? thanks ...
I have a problem , got three Tables Table A ID Employee 1 1 2 2 3 3 Table B Id EMployee HoursWorked HoursCode 1 1 10 Basic Hours 2 1 20 Holiday Pay 3 2 10 ...
As seen below the syntax is different for different Database .Isnt there a standard way that works in all Databases. Is there any tool to convert any sql to any sql SqlServer2005: CREATE TABLE Table01 ( Field01 int primary key identity(1,1) ) Sqlite: CREATE TABLE Table01 ( Field01 integer PRIMARY KEY AUTOINCREMENT NOT NU...
Hi, I have a table in mySQL and has 3 line which has name ,address,Telephone,Age,Charge. in two of them the names are "Adam" and the last row is "Abas" ,i don't know that why it prints in the console like this,please help me thanks! Statement s; int s4,s5;String s1,s2,s3; List<InfoClass> clientList = null; try { ...
Firstly I want to thank all of you who have helped me understand Normalization and how I should build up my database. Now, I have some final issues left... How does LINKING of tables actually work? Say you have three tables: CATEGORY TABLE: cat_id (PK) -> 1 cat_name -> cars CATEGORY_OPTIONS TABLE: cat_opt_id (FK) -> 1 cat_id (FK) ->...
Hi, I'm trying to run a SQL script against SQL Server 2005 as part of the set up for my integration tests. The script works perfectly fine if I execute it from within SQL Server Management Studio. However, when executing programmatically, this part of the script that enables full-text search refuses to work: -- lots of tables and index...
Hi This seems possible, but at the same time I am wondering if it actually is possible. I have a table {users}. I want to pull 5 rows from that table, but at the same time, I want to specify one row. The closest sql statement I get is: SELECT u.id, u.full_name, u2.id, u2.full_name FROM users u JOIN users u2 ON u2.id !=...
Is there any reason why or why not you should do an 'order by' in a subquery? ...
hi all, I have a db with users that have all this record . I would like to do a query on a data like CN=aaa, OU=Domain,OU=User, OU=bbbbbb,OU=Department, OU=cccc, OU=AUTO, DC=dddddd, DC=com and I need to group all users by the same ou=department. How can I do the select with the substring to search a department?? My idea for the s...
I've got the following MySQL query / subquery: SELECT id, user_id, another_id, myvalue, created, modified, ( SELECT id FROM users_values AS ParentUsersValue WHERE ParentUsersValue.user_id = UsersValue.user_id AND ParentUsersValue.another_id = UsersValue.another_id AND ParentUsersValue.id < UsersValue.id ORDER ...
I have several different types of data involving date range that I want to merge together, but at the same time broken down by day. So a 3 day piece of data would result in three rows: start primary_key start+1 primary_key start+2 primary_key I've been playing around using the model clause of the select statement in 10g and was l...
I'm having a hard time working out the following problem efficiently. I have a 15000x15000 xy matrix. I'm storing element locations in this matrix by defining a x,y coordinate for the element. I want to display a part of the matrix in a so called viewport. The viewport dimensions are e.g. 1600x1000 Consider the following db structure: ...
Let's say I have something like this: select sum(points) as total_points from sometable where total_points > 25 group by username I am unable to refer to total_points in the where clause because I get the following error: ERROR: column "total_points" does not exist. In this case I'd have no problem rewriting sum(points) in the where ...
hi, I'm having troubles with an asp.net 2.0 application that I took over from other developers (meaning I don't really know much of the code). It is throwing an unhandled exception, but I cannot get any source info where exactly the exception occurs, and debug stepping through the source suddenly ends with the only option of showing dis...
Hello all, I have strings like that OPEN SYSTEMS SUB GR (GM/BTIB(1111)/BTITDBL(2222)/BTVY(4444)/ACSVTYSAG) and I need to extract 2222 from it. What I was doing is this on the GROUPS String: SUBSTRING(GROUPS, CHARINDEX('(',GROUPS, CHARINDEX('(',GROUPS, CHARINDEX('(',GROUPS,0)+1)+1)+1, 4 ) AS GroupNo However I see that it is no...
I have two tables, 'discussion' and 'discussion_responses'. A unique ID from 'discussion' is used in 'discussion_responses' to identify the response to the original post in a forum. I created the following query to extract the posts that have NEW replies, but are NOT linked to new topics. Both tables have a field for the date added and '...
I'm using MS Visio to model a database and part of the model contains Transaction categories - the parent table has a transactionId, timestamp, amount, and transactionType. There are three child tables - cheque, bank transfer, and credit card, all related to the parent by transactionId. Is there a specific way this kind of relationship...