I have a set of supply operation organised like this: op_type | time_stamp | product | in | out ---------------------------------------------------- 01 | 08:00:00 | p1 | 50 | 0 02 | 08:01:00 | p1 | 0 | 10 02 | 08:02:00 | p1 | 0 | 35 03 | 08:03:00 | p
I have this query: SELECT r.rev_id, rs.name, COUNT(ws.user_id) as likes FROM Reviews AS r LEFT JOIN Wasliked AS ws ON r.rev_id = ws.rev_id LEFT JOIN Restaurants AS rs ON rs.rid = r.rest_id GROUP BY rs.name, r.rev_id ORDER BY likes DESC and the result
I am new to SQL and I just can't figure out how to calculate the average of a certain value in two tables. I have one table that is having all the information of the lakes in the world and i have another tables including all the information of the se
This question already has an answer here: Solutions for INSERT OR UPDATE on SQL Server 21 answers i have a table named tblStockManagement in my database. i have two columns named Client_ID and FoldingID. i want to insert values to the columns, but fi
Consider the following regex @(.*\..*){2,} Expected behaviour:
[email protected] doesnt match
[email protected] doesnt match
[email protected] matches
[email protected] matches and so on Testing in regexpal it works as expected. Using it it in a mysql select doesn't work as expected. Query: SE
I have 2 tables TABLE USERS USER_ID------USERNAME------------REGISTERTIME 1-----------------admin----------1432985224 2-----------------test ----------1433985224 3-----------------test2----------1332985224 TABLE REFERRALS REFERRER_ID----------REFERRA
I think I may be missing the obvious here but im trying to create a sql query to pull data out in a particular way but cant work it out. I have a table which is made up with the following columns: Name, StageDate, Stage I want to create in sql an out
I tried to run yii migrate, but it showed the following error: create table news-cate ...Exception: SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table definition; there can be only one auto column and it must be defined as a key
I need help with the Oracle SQL logic to generate the sequence of dates starting from arrival_dt till depature_dt Please find the current data set prop_id blk_id arrival_dt departure_dt num_stay start_dt day_num star_num booking_num create_dt room_ty
I have a user table that consists of these columns: | id | username | password | email | pants_size_id | shirt_size_id | pants_size_id and shirt_size_id are filled with foreign tables id keys where I store a list of sizes for pants and shirts in diff
I have a table, create table a( id_a number(5) not null, name varchar2(15) not null, address varchar2(30), phone varchar2(15), constraint pk_a primary key (id_a) ); I want add constraint check at phone. example. phone is 08175210868 I want to only be
I have 2 tables "quizzes" & "users", I need to return list of first user took each quiz, with quiz_id: tables structure "quizzes" structure: id name 1 England 2 france 3 Japan 4 USA 5 UAE 6 Sweden 7 Italy 8 Brazil 9 South
I can't seem to find any resources to specifically help me with my problem. I want to be able to pass my variable that I have retrieved from my table to another form so I can tell who has signed in. I want to be able to pass the variable called signe
Each of the salesmen should make a forecast of his sales. I know how he may input data directly from Excel sheet to SQL table. Do I need to create different tables - one table per salesman? At the end I need to aggregate all the forecasts. Is it poss
I'm using SQL Server 2008 R2 and trying to do a query like this: SELECT * FROM finance WHERE paid > 1000 and not (city <> 'RJ' and (flag2 is null or flag2 = '0')) But i'm not getting the desire solution. My idea is to search all payments bigger t
I have a java class that gives me time_in and time_out. Time_in and time_out are also tables in my sql database. I'd like to find work hours which can be calculated as time_out - time_in. Time_in and time_out are time format (hh:mm:ss). How to find t
I have Month Name And Year from that I want Date Range of that Month. Input @Input=August 2014 Output @fromDate=08/01/2014(MM/dd/YYYY) @toDate=08/31/2014 Please Help me to do thisTry This DECLARE @SystemDate DateTime, @StartDate DateTime, @EndDate Da
I want to run this query : SELECT firstName , secondName , lastName FROM (SELECT firstName,secondName,lastName FROM table1 UNION SELECT firstName,NULL,NULL FROM table2 )resutls I want add two Null columns to the second test, How could I do that ? or
I have a slight twist on the other "in one table but not another" threads I've seen. I have 3 tables: ProductFeed ProductFeedID INT ProductName NVARCHAR(30) Product ProductID INT ProductFeedID INT StorefrontID INT Storefront StorefrontID INT Sto
i have problem with my site. i want to create a page in php. in this page i want user invite user. but i have a error. i dont know what to do. thx all . the error: SQL Error: You have an error in your SQL syntax; check the manual that corresponds to
Consider 3 tables (* for primary key, + for foreign): User {*id:INTEGER, name:VARCHAR(45)} Flight {*id:INTEGER, service:VARCHAR(45), departureDate:DATETIME} Reservation { +userId, +flightId } Data: User: Flight: Reservation: The following Query will
I am trying to enter a studentID in a windows form text box and I want the corresponding label to change text from label1 to the data from the name column. I am really confused with the code, therefore the following. private void button1_Click(object
My table looks like this: Table 1: Note: This table is very large in reality, with lots more columns (20ish) and rows (in the millions) | Time | tmp | productionID | | 10:00:00 | 2.2 | 5 | | 10:00:05 | 5.2 | 5 | | 10:00:11 | 7.4 | 5 | | ...... | 3.2
DECLARE @d DATETIME = '01/01/2011'; SELECT FORMAT ( @d, 'd', 'en-US' ) AS US_Result; I am using above code in SQL Server 2008 R2 but it is encountering an error: 'FORMAT' is not a recognized built-in function name. How can I use FORMAT function?FORMA
I'm having some trouble searching for any similar match in two fields. For example I have a table with the values: CAR MAKE CAR MODEL Ford Mustang (Shelby) Toyota Corolla Seat Leon etc etc. I want to be able to get the result "Ford, Mustang (Shelby)&
Can you please give me an database design suggestion? I want to sell tickets for events but the problem is that the database can become bootleneck when many user what to buy simultaneously tickets for the same event. if I have an counter for tickets
Tried my usual references at w3schools and google. No luck I'm trying to produce the following results. QTY is a derived column | Position | QTY -------------------- 1 Clerk 2 2 Mgr 2 Here's what I'm not having luck with: SELECT Position, Count(posit
Is there mysql's INSERT IGNORE equivalent in MS SQL Server 2005 or something similar?you can implement something like this with an INSTEAD OF trigger, intercepting the default insert action to perform updates where existing rows are detected. Not qui
I have this to select a date from a mysql db, and compare it to an array of month-names in swedish language. $monthnames = array("","Januari","Februari","Mars","April","Maj","Juni",&quo
I have four tables I want to join and get data from. The tables look something like... Employees (EmployeeID, GroupID[fk], EmployeeName, PhoneNum) Positions (PositionID, PositionName) EmployeePositions (EployeePositionID, EmployeeID[fk], PositionID[f