I would like to create hhID in my column based on values in NodeID. IF nodeID is empty, hhId should be a copy of UID, If not, then hhID should be a combination of all UIDs with the same values of nodeID.I have put dummy text here; ‘Nepal is there’. However, for UID, ‘JBGNARZ1’, hhID should be JBGNARZ1, JRL0UUOI. I
Tag: mysql
SQL multirow data on one row
I almost never ask a question, so please be patient with me. Example Orders table: Order_ID Ord_Partno Ord_UnitPrice Ord_Qty 1658712 PN001 $1.20 9 1658712 PN002 $2.40 4 1658712 PN003 $1.40 21 1658712 PN004 $1.10 16 Example Inventory table: Inv_Partno Inv_Warehouse Stock PN001 Atlanta 14 PN001 AtlantaHold 0 PN001 Chicago 7 PN001 ChicagoHold 0 PN002 Atlanta 5 PN002 AtlantaHold 18 PN002
Is it possible to use result or state of query in same query
For example I have this table events: user_id event_type date_of_event userA X 01-01-2000 userA Y 01-01-2005 userB X 01-01-2000 userB Y 01-01-2100 I want to select all users that have an event_type = X but no event_type Y in the next 2 years AFTER the date of event_type X. So in the table above that would be userA and userB
MySQL Circular References in One-to-Many Relation: Is there a way to avoid it?
Consider following as an example: I have a User table which contains user’s information along with a PrimaryAddress column that references Address table. The Address table, contains address information along with a UserId column which refers to who the address belongs to. Each user can have many addresses, but only one address can be PrimaryAddress. Therefore, the User table needs
INSERT INTO query WITH RECURSIVE query
I have created a WITH RECURSIVE function and would like to use it with an INSERT INTO function so that the results insert into the path column. category_id category_name parent_id path 1 Root 0 2 Fishing 1 3 Sea 2 4 Lures 3 7 Coarse 2 8 Lures 7 9 Fly 2 I have tried the following code but the
Check all possible connection exists
I want to check for all connections between two table exists and return all rows specifying weather the connections exists or not for example here is my tables: Permissions: index Controller Action 5 Error index 2 Home index 3 Home login 4 Home logout 1 Test index 9 UserManagement createUser 8 UserManagement editUser 6 UserManagement index Roles_Permissions: Roles Permissions 1
SQL Query for the Last 6 Months of users registered
I have created a query that shows the last 3 months of users registered to my site and currently have it grouped by day to show on a line graph. I would prefer to show it Grouped by Week on the line graph but have been unable to change my query successfully. Here is what I have written so far:
Time Based SQL Injection attack affect all users or just me?
Sorry for asking this silly question but If I found a website which is vulnerable to time base SQL Injection attack. For example I am using (sleep 20) means server will sleep for 20 seconds and then respond me so the server is down for 20 seconds only for me or all the users on website??? Answer Yes, sleep() function
Can a backticked identifier have a backtick in it?
Is it possible to escape a SQL identifier in either MySQL or BigQuery or any other RDBMS that allows quoting of identifiers with the ` character? For example: Works, but then How would I add a literal backtick to it, or is that just not allowed? Answer Yes. Use a doubled backtick, eg: This is similar syntax for including quotes
Adding a set to a database table, using format string – how to include null values
I have a set that depending on the situation can contain anywhere between 1 and 5 elements. I am saving this set to a database table using a format string. My table contains 5 tables, but when creating it, I did include that it was okay to have null values in the columns. my set below can be: but it